Original Post
I have a table in lua like this and I need to be able to access the bounds at random such as x = bounds[5].x; but I need to do this from c/c++ I tried rawgeti but when I try get x or y it seg faults ex: is there another way to get random access to an array in lua from c/c++ [Edited by - coolkehon on October 24, 2009 5:58:44 PM]
room =
{
start = { x=111; y=125; },
bgcolor = "3399FF",
bounds =
{
{ x = 120; y = 72; },
{ x = 192; y = 110; },
{ x = 149; y = 134; },
{ x = 182; y = 152; },
{ x = 143; y = 172; },
{ x = 161; y = 182; },
{ x = 141; y = 193; },
{ x = 25; y = 135; },
{ x = 101; y = 96; },
{ x = 88; y = 89; }
};
}
lua_rawgeti(m_state,-1,5);
lua_getfield(m_state,-1,"x");