lua-style function calls and luabind

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

lua-style function calls and luabind

Sebastian Reiter

I'm trying to call lua-functions from C. Since the parameters that  
have to be passed to lua are organized in lists of arbitrary length,  
luabind::call_function does not seem to be suited. I thus tried to  
call them using the standard lua-way of calling functions:

// begin code

        lua_getglobal(L, "some_function"); // the function i want to call

        for(size_t i = 0; i < params.size(); ++i){
                case USERDATA:
                        lua_pushlightuserdata(L, params[i].get_userdata());

                case NUMBER:
                        lua_pushnumber(L, params[i].get_number());

        if(lua_pcall(L, params.size(), 0, 0) != 0)

// end code

Since "some_function" previously was registered using luabind, luabind  
raises an (expected) error: "No matching overload found".

Does luabind feature anything similar to the stack-mechanism of lua  
when it comes to calling lua-methods from C?
I would like to preserve the type-safety of luabind.


Kind regards,

luabind-user mailing list
[hidden email]