lua-users home
lua-l archive

Re: Passing arrays from C++ to LUA

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


void lua_rawseti (lua_State *L, int index, int n);
Does the equivalent of t[n] = v, where t is the value at the given
valid index and v is the value at the top of the stack.
This function pops the value from the stack. The assignment is raw;
that is, it does not invoke metamethods.
This is from the manual. Basically, index is the index on the stack
of the table and n is the array index.
For a stack like
2: 3.4
1: table
You could call
lua_rawseti(L, -2, 1) to put 3.4 at table index 1 (table[1] = 3.4).
wes

AltStyle によって変換されたページ (->オリジナル) /