I have created a lua table in C, but i'm not sure how to push that table onto the top of a stack so I can pass it to a lua function.
Does anyone know how to do this?
This is my current code:
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 ]