Dmitry Samersoff wrote:
No, your code is wrong. You messed up with the index to the copy of the key and value.Now it works.
After lua_next() your stack looks: table key value * The index of the key is -2, and the index of the value is -1. After lua_pushvalue(L, -2) your stack looks: table key value copy_of_key *You should work with the copy of the key. Its index is -1. Value's index is -2.
After lua_pop(L, 2) your stack looks: table key * Got it?
Attachment:
signature.asc
Description: OpenPGP digital signature