-
Notifications
You must be signed in to change notification settings - Fork 40
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
Debug names of C functions for Luau #163
Comments
Makes sense, the purpose of these _x version of lua methods is to be able to make them usable by both puc lua, luajit and luau. If luau needs this debug name maybe we can make a macro instead ? |
How it will looks like and will it be used in namespace/class bindings to set debug names for member/static functions? |
We could use the name provided in the addFunction to inject it into the method, will try something. Question, why luau is not able to determine the name of the lua function being called? |
Can you write a repro case so we could add a unit test for it ? |
There's no any special case for this. Just write binding for class and method, use it in Lua with wring argument and check for this error. Maybe debug name can be shown using some function but I didn't check. class MyClass {
void Foo(int a) {}
};
luabridge::getGlobalNamespace(L)
.beginClass<MyClass>("MyClass")
.addMethod("Foo", &MyClass::Foo)
.endClass(); local myClass -- MyClass instance
myClass:Foo('wrong type of argument') |
Could you check if #164 would work for you ? |
As a side note, if you install a error handler callback when executing your lua code (from c++) incoking the binded method, you could print the traceback and the name of the function should appear. |
Luau when getting errors tries to find debug name of function, but as I see, LuaBridge in
lua_pushcfunction_x
andlua_pushcclosure_x
set it empty. So I often get errors likeinvalid argument #1 to ''
and it's hard to debug when your lua code has a lot of calls of C functions. Maybe you should make newlua_pushcfunction_x
andlua_pushcclosure_x
or modify existing to set this debug name properly. Also I'll try to implement it by myself in a PR, if you want.The text was updated successfully, but these errors were encountered: