Open Silverlan opened 1 year ago
You can add a method __debugger_tostring
to the metatable.
You can add a method
__debugger_tostring
to the metatable.
Works like a charm, thanks! I think it would be a good idea to put this in the readme, since it doesn't seem to be documented anywhere at the moment.
One more thing:
Would it be possible to allow us to overwrite the displayed type of the values? At the moment, it just says "userdata" for custom types:
The points
table has values of types {Vector,Vector,EulerAngles}
, but it just says {userdata,userdata,userdata}
, which is not very helpful. Maybe another metatable function, like __debugger_gettypename
?
You can set __name
in metatable.
It really should be documented, but the problem right now is that there isn't any documentation.
You can set
__name
in metatable.
I did try setting __name
, but it didn't seem to have any effect:
__name
is set in the metatable, but it still shows as userdata
. Here's how I'm pushing the __name
string into the table:
lua_pushstring(l, "__name");
lua_pushstring(l, "Test");
lua_settable(l, -3);
I also tried pushing a getter function instead (i.e. the same as __debugger_tostring
), but that did not work either.
Well, it didn't work as expected. I'll fix it in the next version.
I'm using luabind to bind some classes in C++ to make them available in Lua:
When debugging a Lua script, I would like to be able to see the values of the x, y and z properties for variables of this type, but this does not seem to be possible at the moment:![Code_2023-03-19_15-38-10](https://user-images.githubusercontent.com/3609960/226183225-1287bebf-378f-47f1-a7d0-beb64c7b4f38.png)
Could something like this be implemented? Alternatively, it would be useful to see the![zbstudio_2023-03-19_15-47-59](https://user-images.githubusercontent.com/3609960/226183825-c618a1e1-e0ed-4bf9-8fe5-4fb987092489.png)
__tostring
text of the value. In the ZeroBrane IDE you can hover over a variable to view its__tostring
text:It's very useful for debugging, especially when working with math-type classes.