lua-style function calls and luabind
Sebastian Reiter <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
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){
switch(params[i].type)
{
case USERDATA:
lua_pushlightuserdata(L, params[i].get_userdata());
break;
case NUMBER:
lua_pushnumber(L, params[i].get_number());
break;
//...
}
}
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.
Thanks,
Kind regards,
Sebastian
------------------------------------------------------------------------------