Page 1 of 1

Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 4:50 am
by jpnk
any chance to see that happen?

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 4:57 am
by slime
Nope. Lua 5.2 has low adoption among tools and libraries and it's not backwards compatible with Lua 5.1 code in many cases - especially in its C API.
In particular, luasocket currently only supports Lua 5.1, and LuaJIT is fully compatible with Lua 5.1 (so can be used as a drop-in replacement), but not so with Lua 5.2.

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 5:13 am
by jpnk
thanks. i just bumped into an annoying bug that is fixed in 5.2. *sigh*

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 5:14 am
by slime
What's the bug? Maybe it's fixed in LuaJIT as well.

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 4:19 pm
by Inny
The only notewhile feature we receive in lua5.2 is the _ENV table, which is cool and all, but we get along fine without it.

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 6:39 pm
by jpnk
slime wrote:What's the bug? Maybe it's fixed in LuaJIT as well.
'__len' metamethod isn't invoked on tables. so '#some_table' always returns the actual length of some_table and the metatable isn't checked.
Inny wrote:The only notewhile feature we receive in lua5.2 is the _ENV table, which is cool and all, but we get along fine without it.
in general i can't complain about lua5.1 either. my ride with it has been quite smooth... until yesterday:)

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 6:46 pm
by markgo
In 5.1, I'm pretty sure the __len metamethod only applies to userdata. So it would not be a bug. 5.1 should do you well anyways. Good luck.

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 7:09 pm
by Boolsheet
Indeed. That it works on tables too is new to 5.2. From http://www.lua.org/manual/5.2/readme.html#changes:
tables honor the __len metamethod

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 8:18 pm
by slime
if LuaJIT is built with "-DLUAJIT_ENABLE_LUA52COMPAT" then you get the __len metamethod on tables as well.

Re: Lua 5.2 in LÖVE 0.9.0

Posted: Sat Jun 08, 2013 8:39 pm
by jpnk
slime wrote:if LuaJIT is built with "-DLUAJIT_ENABLE_LUA52COMPAT" then you get the __len metamethod on tables as well.
that should work for me. thanks a lot.