Lua and C++ Debugger
The C++ object debugger for Lua is working now. It was a little tricky, but I implemented a method to view all members of C++ objects. The debugger does handle dynamic object fetching, so if you expand a node in the debug tree representing a C++ object, the contents of that object will be loaded and displayed. Let's say you have an entity parented to another entity. This allows you to expand the parent member of the child, then find the child in the parent's child list, and so on, ad infinitum.
If you're interested in how this works internally, every class in LE3 is derived from a base class called "Object". The Object class has a virtual function called Debug() which returns a string in a format like the following:
entity={position={x=0,y=0,z=0},rotation={x=0,y=0,z=0},scale={x=1,y=1,z=1},parent=0x00fh7fC}
This is read by the debugger and used to create more readable nodes in the debug tree. The hex address listed for all pointers can be compared to values in C++ or another language, if needed. Classes that are used as direct objects, like math classes, and, well,. nothing else, simply output their data like this:
v={0.0,0.0,0.0}
Hard to explain, but easy to understand when you just look at the debugger.
2 Comments
Recommended Comments