I would like to access this table and any local lua table from C++. I am able to query the global lua table using the following code. which queries the global lua table perfectly. Is there any identical mechanism avaialble for querying local lua tables dynamically
lua_getglobal(L, key);
int pos = lua_gettop(L);
lua_pushnil(L);
char temp[150]={0},temp1[150]={0};
int i = 0;
std::vector<std::string> tableValues;
while(lua_next(L, pos) != 0)
{
sprintf(temp1,"%s = %s",lua_tostring(L, -2), lua_tostring(L, -1));
tableValues.push_back(temp1);
lua_pop(L, 1);
}
Thanks