我在C中创建了一个Lua表,但我不确定如何将该表推送到堆栈顶部,以便我可以将其传递给Lua函数。
有人知道如何做吗?
这是我的当前代码:
有人知道如何做吗?
这是我的当前代码:
lua_createtable(state, libraries.size(), 0);
int table_index = lua_gettop(state);
for (int i = 0; i < libraries.size(); i++)
{
lua_pushstring(state, libraries[i].c_str());
lua_rawseti(state, table_index, i + 1);
}
lua_settable(state, -3);
[ Push other things ]
[ Call function ]