lua-users home
lua-l archive

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


Tom Sutcliffe <tomsci@me.com>于2018年4月16日周一 下午8:22写道:
Hi list,

I've been reviewing some of my native code for safety and noticed that I've been assuming lua_next() will not raise arbitrary errors. In the 5.3 documentation however, lua_next is listed as 'e' meaning it can.

I couldn't think of any obvious reason how it could error, since there is no metamethod to override a next iteration, and I couldn't see anything in the implementation that would trigger an __index. Am I missing something or is the documentation incorrect?


`lua_next`  may raise error when you pass a key that is not exist in the table.