我想从 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 值为零。我不想为我需要的每个值编写一个函数,而是利用 Luas 功能从函数中检索多个参数。