lua-users home
lua-l archive

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


Hi,

I have found an error that forces the programmer to write backwards compatible code if the target is default-compiled Lua 5.3.x.

If LUA_COMPAT_IPAIRS is defined (which it is by default), Lua always ignores __index and only checks for __ipairs.
Therefore ipairs does not work for userdata with an adequate __index field.

Details:
Ibaselib.c:258 luaB_ipairs will result in a call to pairsmeta.
pairsmeta calls luaL_checktype(L, 1, LUA_TTABLE) instead of luaL_checkany which results in this problem.


undef