User Tools

Site Tools


lua:lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
lua:lua [2008/09/01 14:36] – created devalua:lua [2008/09/01 15:42] deva
Line 8: Line 8:
 <code c> <code c>
 lua_createtable(L, 0, 3); lua_createtable(L, 0, 3);
 +int top = lua_gettop(L);
 +// add '1' to the list
 lua_pushinteger(L, 1); lua_pushinteger(L, 1);
 +lua_rawseti(L, top, 0);
 +// add '2' to the list
 lua_pushinteger(L, 2); lua_pushinteger(L, 2);
 +lua_rawseti(L, top, 1);
 +// add '3' to the list
 lua_pushinteger(L, 3); lua_pushinteger(L, 3);
-lua_rawset(L, -3);+lua_rawseti(L, top, 2); 
 + 
 +// and then some code to bind it to "myarray"
 </code> </code>
lua/lua.txt · Last modified: 2012/04/20 13:53 by deva