Pushing a Lua Table

BlitzMax Forums/BlitzMax Programming/Pushing a Lua Table

I can't be entirely sure, pretty new to Lua myself, but it sounds like you need lua_pushvalue to push a copy of the object table onto the top:
lua_pushstring(state,"object_index")
' ... [ "object_index" ]
lua_gettable(state,LUA_GLOBALSINDEX)
' ... [ {objectindex} ]
lua_pushnumber(state,index)
' ... [ {objectindex} ], [ index ]
lua_gettable(state,-2)
' ... [ {objectindex} ], [ {object} = {objectindex}[index] ]
lua_pushstring(state,"update")
' ... [ {objectindex} ], [ {object} ], [ "update"]
lua_gettable(state,-2)
' ... [ {objectindex} ], [ {object} ], [ update() = {object}.update ]
lua_pushvalue(state,-2)
' ... [ {objectindex} ], [ {object} ], [ update() ], [ {object} ]