Lua 5.2 in LÖVE 0.9.0

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
jpnk
Prole
Posts: 8
Joined: Mon Dec 24, 2012 2:12 pm

Lua 5.2 in LÖVE 0.9.0

Post by jpnk »

any chance to see that happen?
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Lua 5.2 in LÖVE 0.9.0

Post 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.
User avatar
jpnk
Prole
Posts: 8
Joined: Mon Dec 24, 2012 2:12 pm

Re: Lua 5.2 in LÖVE 0.9.0

Post by jpnk »

thanks. i just bumped into an annoying bug that is fixed in 5.2. *sigh*
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Lua 5.2 in LÖVE 0.9.0

Post by slime »

What's the bug? Maybe it's fixed in LuaJIT as well.
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Lua 5.2 in LÖVE 0.9.0

Post 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.
User avatar
jpnk
Prole
Posts: 8
Joined: Mon Dec 24, 2012 2:12 pm

Re: Lua 5.2 in LÖVE 0.9.0

Post 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:)
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

Re: Lua 5.2 in LÖVE 0.9.0

Post 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.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Lua 5.2 in LÖVE 0.9.0

Post 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
Shallow indentations.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Lua 5.2 in LÖVE 0.9.0

Post by slime »

if LuaJIT is built with "-DLUAJIT_ENABLE_LUA52COMPAT" then you get the __len metamethod on tables as well.
User avatar
jpnk
Prole
Posts: 8
Joined: Mon Dec 24, 2012 2:12 pm

Re: Lua 5.2 in LÖVE 0.9.0

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

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 24 guests