Closed jbromberg closed 4 months ago
I think this is the line where arguments get passed into the function call: https://github.com/WeaselGames/godot_luaAPI/blob/edf4afe7665a03978e8a4a3a15b727a66c4dc03d/src/luaState.cpp#L179
Currently the best way to use tuples in class methods is to have a member variable of the type LuaCallableExtra. You can define the var and use a lambda method for the method definition. Another option is to wrap the method in a LuaCallableExtra in __index.
I am open to cleaner solutions though if you find something that could be done.
I did this for now. It's working, thanks!
func __index(ref: LuaAPI, index: String):
if has_method(index):
return LuaCallableExtra.with_tuple(Callable(self, index), 1)
return get(index)
Is your feature request related to a problem? Please describe. I'm trying to ensure a method call on my GDScript class is always called with a
LuaTuple
argument. See the code snippet below.I'd like for it to be a
LuaTuple
so I can do custom overloading based on the args and because in some cases I also register these functions as globals usingLuaCallableExtra.with_tuple
.Describe the solution you'd like Either the
__index
func could get called with an args parameter so I can bind it to the callable or some parameter onLuaAPI
or thepush_variant
method that allows me to have methods called with aLuaTuple
.