lua-users home
lua-l archive

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


Hey everyone, I'm quite new to PBapi for Lua (structure is the same as in the C api)
I've been struggling for ages to push a table on the stack and fill it with data... this is what i've got
 
lua_newtable(*lua)
 
lua_pushstring(*lua, "NodeName")
lua_pushstring(*lua, "Nodevalue")
lua_settable(*lua, -3)
 
So inserting strings, booleans and numbers into a nummerically index, or name indexed table is getting along nice.
But now I'd like to insert a table in a node, and I'm completely lost here.
 
This is the Purebasic syntax
 
ProcedureC Somefunction(*lua)
    lua_newtable(*lua)
    For i=1 to 20
        lua_pushnumber(*lua, i)
        lua_pushstring(*lua, "Nodevalue")
        lua_settable(*lua, -3)
    next
EndProcedure
 
Instead of pushing a string, i'd like to push a table in that index. How would I do that? (even the filling must be done in that moment)
 
Thanks,
Bas