lua_rawgeti(L, LUA_REGISTRYINDEX, class);
g_assert(lua_type(L, -1) == LUA_TTABLE);
lua_getfield(L, -1, cmd);
g_assert(lua_type(L, -1) == LUA_TFUNCTION);
lua_pushstring(L, args);
g_assert(lua_type(L, -1) == LUA_TSTRING);
if (0 != lua_pcall(L, 1, 1, 0)) { // pass 1 argument, get 1 value...
...
The method call of 'cmd' on 'class' works, but I cannot seem to get args to be
passed in. The following code looks similar to the lua method:
function class:cmd(args)
print("type " .. type(args)) -- prints 'type nil'
end
Does anyone know what I'm missing in order to get a string passed into
class:cmd(...)?