我想从C函数中获取Lua中的几个参数。 我尝试将多个参数推送到lua栈上:
static int myFunc(lua_State *state)
{
lua_pushnumber(state, 1);
lua_pushnumber(state, 2);
lua_pushnumber(state, 3);
return 1;
}
然后在 Lua 中像这样调用:
local a,b,c = myFunc()
不幸的是,b和c的值都为nil。我不想为每个我需要的值编写一个函数,而是要利用Lua从函数中检索多个参数的能力。