3.13 – Using Tables as Arrays

The API has functions that help to use Lua tables as arrays, that is, tables indexed by numbers only:

  1. void lua_rawgeti (lua_State *L, int index, int n);
  2. void lua_rawseti (lua_State *L, int index, int n);

lua_rawgeti pushes the value of the n-th element of the table at stack position index. lua_rawseti sets the value of the n-th element of the table at stack position index to the value at the top of the stack, removing this value from the stack.