|
lua_tostring can throw off lua_next. You can use lua_pushvalue to create a copy of the item and then use lua_tostring on that copy (then pop the copy) and lua_next will still be good-to-go.
To be more clear re lua_tostring -> http://pgl.yoyo.org/luai/i/lua_next