pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.59k stars 518 forks source link

Cannot see details of user defined type from C++. #1138

Closed baransrc closed 2 years ago

baransrc commented 2 years ago

Greetings,

I have been testing LUA to integrate it to the game engine we are creating on our Master's degree project. For it to be a feasible option for us to use as the scripting language of our engine, I'm trying to see how much debug-able LUA is through your lovely IDE.

In the dummy LUA script I've written, we are using user types that is defined by the Engine code using LUA binding library sol. Is there a way to see the details of them, such as their fields and values of their fields?

Right now what we have is: image

Where hachiko.entity is an Entity and it has a field called ID for example. Of course when I add hachiko.entity.ID to watch window, it shows its value, but I wanted to see if there is a functionality that handles this for each field of user defined types automatically(Like the watch of Visual Studio). I'm sorry if this is a silly question to ask as I'm a C++ and I'm not used to LUA enough.

Sincerely yours, Baran

pkulchenko commented 2 years ago

You should be able to add __tostring metamethod to your userdata object and it will be used to display the object in the watch/stack windows. You can also return a table from the __tostring object, which allows you to display a table if that's the best representation for your userdata object. You won't need anything else to support this on the IDE side.

baransrc commented 2 years ago

Thanks!!