lua-users home
lua-l archive

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


2016-07-18 12:29 GMT+02:00 Tarek Sabet <undefdev@gmail.com>:

> I'm sending this again, because for some reason the last time I sent this it
> ended up unreadable.

It did not; I saw it, but hoped someone else would reply.

> 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.

It is not a bug.

LUA_COMPAT_IPAIRS means "make ipairs behave as in Lua 5.2". In Lua 5.2,
ipairs does raw access (though the documentation only says so if you read
very carefully), so __index is not consulted.