I ve written a function in C++ which is getting items inside container. I need to put those variables in table, but anything I do, script is always overwriting first cell of table. Im using Lua 5.0
Container *box = dynamic_cast<Container*>(item);
if(box)
{
lua_newtable(L);
int top = lua_gettop(L);
int n = box->lcontained.size();
for(int i = 0; i <= n; i++)
{
Item* karta = box->getItem(i);
if(karta)
{
setField(L,"slot", i);
setField(L,"kartaid", karta->getID());
lua_settop(L, top);
}
}
}