I have a std::list of objects, and I want to give Lua a function that returns its 2D positions. So I need to create a table of tables
{ {x,y}, {x,y}, {x,y}...}
And since its all on a list, I need to create it while iterating the list..
lua_newtable(L_p); // table at 0
int tableIndex = 1; // first entry at 1
for( std::list<AmmoDropped*>::iterator it = m_inputAmmosDropped.begin();
it != m_inputAmmosDropped.end();
++it ){
// what do I do here
++tableIndex;
}
// returns the table
return 1;
Indexed by integer keys, and by 'x' and 'y':
positions[0].x
positions[0].y
Id try by trial and error, but since I don't know / don't have how debug it for now, I'm really lost.