【发布时间】:2013-10-23 14:31:09
【问题描述】:
我想从 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 功能从一个函数中检索多个参数。
【问题讨论】: