User Tools

Site Tools


lua:lua

This is an old revision of the document!


LUA

c/c++

myarray = {1,2,3};

corresponds to

lua_createtable(L, 0, 3);
int top = gettop(L);
// add '1' to the list
lua_pushinteger(L, 1);
lua_rawseti(L, top, 0);
// add '2' to the list
lua_pushinteger(L, 2);
lua_rawseti(L, top, 1);
// add '3' to the list
lua_pushinteger(L, 3);
lua_rawseti(L, top, 2);
 
// and then some code to bind it to "myarray"
lua/lua.1220276476.txt.gz · Last modified: 2008/09/01 15:41 by deva