You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there doesn't seem to be a way to inspect a class and its methods/properties from C/Cpp.
Lua uses a table structure that can be inspected, and while it may be possible to add a properties map in the class with a specific name that can be used to manage the handles, this is at best an iffy workaround.
Any plans or suggestions on how this could/should be handled?
My first guess (which I'm not sure is the case already), would be to follow the same pattern Lua does by making the class handle also a map, so as long as you know the class name you can inspect its properties. This could also allow for checking if a handle has a callable method before using wrenCall and avoiding a runtime error.
The text was updated successfully, but these errors were encountered:
There is a pull request/draft for a reflection API at #1006. I should update it sooner or later. I'm currently busy with other stuff, but I updated the change set last week to improve it.
Forgot to say, a quick and dirty way to do it would be to make Class iterable (by implementing iterate(_) and iteratorValue) so it output the symbols, but that will be not accepted in main for various reasons. But if you need it, you can easily implement it for yourself.
Just wanted to add that attributes were added at some point. I suppose it might be a little time consuming but if you tag the methods/props you want to reflect though then you can access them elsewhere or in wren. I'm using attributes to serialize/deserialize.
Currently there doesn't seem to be a way to inspect a class and its methods/properties from C/Cpp.
Lua uses a table structure that can be inspected, and while it may be possible to add a properties map in the class with a specific name that can be used to manage the handles, this is at best an iffy workaround.
Any plans or suggestions on how this could/should be handled?
My first guess (which I'm not sure is the case already), would be to follow the same pattern Lua does by making the class handle also a map, so as long as you know the class name you can inspect its properties. This could also allow for checking if a handle has a callable method before using wrenCall and avoiding a runtime error.
The text was updated successfully, but these errors were encountered: