pub.lua - iterating through a table
BlitzMax Forums/BlitzMax Programming/pub.lua - iterating through a table
| ||
The following code iterates through the values inside an lua table without consequence - if none of the keys are integers. Otherwise it breaks, giving an "invalid key to 'next'" error after it comes across one.Local i%=lua_gettop(state) lua_pushnil state While lua_next(state,i) Print lua_typename(state,lua_type(state,-1))+" : "+lua_tostring(state,-2) lua_pop(state,1) Wend What am I doing wrong? Last edited 2012 |