Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Lua script instances while unboxing Object Variants #47

Open
gilzoide opened this issue Mar 15, 2023 · 0 comments
Open

Get Lua script instances while unboxing Object Variants #47

gilzoide opened this issue Mar 15, 2023 · 0 comments

Comments

@gilzoide
Copy link
Owner

Using Godot Object pointers provide unexpected results regarding the access to properties that are not declared (see #46).

Using Lua tables, it doesn't matter if a property is declared or not, so it should be possible to set new values to Lua instances from Lua regardless of property declaration. It won't work from GDScript or other languages, but people might be writing all scripts in Lua, so it's more useful to have script instances automatically unboxed, if available.

Using GD.get_lua_instance from Variant.unbox should be enough, falling back to the original Object pointer if there is not Lua script attached to it. The cost of this operation is a single table index, so it shouldn't be a problem regarding performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant