lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


ASQeS> Hallo,
ASQeS>         Let t be the index of the table in the stack. One may write:

ASQeS> lua_pushstring(lua_state, "key");
ASQeS> lua_gettable(lua_state, t);

ASQeS> and then the value will be pushed in the stack.

I considered doing that, which would work fine for a single layered
table, but if we want to have more nested configurations like:

character =
{
  name = "Test"
  startPositions =
  {
    pos1 = {x=50, y=10},
    pos2 = {x=30, y=20},
  }
}

then you would need to have the config program's GetValue() accessor handle
multiple keys / sub-keys wouldn't you?.

If we want to make a call like
GetValue("character.startPositions.pos1.x", 0), does this mean we have
to iterate through the key and break it into sub-keys before we get
down to the value??? Maybe I'm missing something - I haven't used LUA
a lot, so this is quite likely :)

Thanks,
Daniel
daniel@kromestudios.com