Lua 5.2 released, is there a plan to use it?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
_ex_
Citizen
Posts: 65
Joined: Thu Dec 08, 2011 2:59 pm

Lua 5.2 released, is there a plan to use it?

Post by _ex_ »

Hi,

I would like to know from the development team if there are any plans to
port the Lua interpreter on the engine to the new brand released version.

Best
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: Lua 5.2 released, is there a plan to use it?

Post by Xgoff »

probably not anytime soon:
  1. few libraries have been ported so far, so anyone using... anything more than luasocket are going to have problems
  2. luajit isn't likely to support it for a while (apart from the occasional easy-to-port features) which could be a problem for some users, or for its theoretical adoption into löve
  3. some of the new features are nice, but for the most part aren't important enough for most users to care. _ENV breaks existing sandboxes, luajit or patches exist for uncrippled yields and xpcall, obviously parts of the C api are changed, etc
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Lua 5.2 released, is there a plan to use it?

Post by kikito »

I didn't know it was officially out!

Thanks for bringing that up.

I would not move LÖVE to 5.2 just yet - Maybe in LÖVE 1.0 ? Nevertheless, it's not that I can decide on those matters.
When I write def I mean function.
User avatar
pk
Citizen
Posts: 67
Joined: Wed Dec 14, 2011 2:13 am
Location: Texas, United States
Contact:

Re: Lua 5.2 released, is there a plan to use it?

Post by pk »

Note that you can start compiling Lua 5.2 with LÖVE right now and start reporting what breaks.
ALL CREATURE WILL DIE AND ALL THE THINGS WILL BE BROKEN. THAT'S THE LAW OF SAMURAI.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lua 5.2 released, is there a plan to use it?

Post by bartbes »

It's not like we can force you to use any specific version of lua with love, you decide upon that at compile-time, it's just that we'll make our source compatible with, and our binaries built with 5.1, until 5.2 is more common, it seems a bit weird to have code that depends on 5.2 when 90% of the people can't get it.
User avatar
subrime
Citizen
Posts: 76
Joined: Thu Nov 13, 2008 6:18 pm
Location: Australia

Re: Lua 5.2 released, is there a plan to use it?

Post by subrime »

90% of the people can't get it...? Are you counting all the people in Africa without any internet access or something?

Anyone (on the net) can download it from http://www.tecgraf.puc-rio.br/lua/ftp/lua-5.2.0.tar.gz

It compiles cleanly in a few seconds, and has no external dependencies... one of the most painless builds in existence.

What do you mean with the 90% can't get it?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Lua 5.2 released, is there a plan to use it?

Post by bartbes »

Well, I'm the linux maintainer, and I like to overstate the amount of people running linux here. That said, even though it compiles cleanly, there will be few repos that actually have 5.2.
User avatar
_ex_
Citizen
Posts: 65
Joined: Thu Dec 08, 2011 2:59 pm

Re: Lua 5.2 released, is there a plan to use it?

Post by _ex_ »

pk wrote:Note that you can start compiling Lua 5.2 with LÖVE right now and start reporting what breaks.
I upgraded to Lua 5.2 this morning and I needed only small changes to get everything compiling and running.
hey, at least my simple tetris clone is working!! :D

Not sure if something else gets broken, of course I don't use external lua modules and because I started modifying the engine to support another script language my code base is a bit different than head and maybe helped, if somebody wants to upgrade and get stuck just drop me a line.
I think I'll go with 5.2, having break at any place inside a block, the goto, the bit library and the more documented source code is a deal breaker for me.

Regards.
User avatar
_ex_
Citizen
Posts: 65
Joined: Thu Dec 08, 2011 2:59 pm

Re: Lua 5.2 released, is there a plan to use it?

Post by _ex_ »

After further tests, I was able to play Ortho Robot (awesome game by the way):

http://stabyourself.net/orthorobot/

with Lua 5.2, the only crashing part was math.mod(x, y) that I translated to: (x % y)
There was a bug in the math.mod 5.1 implementation anyway...

Therefore I don't see major problems to use new Lua 5.2 except maybe some heavily used modules used by the community
but I also don't think fixing them would take more than a day of work but I can be wrong (I don't use any)

I only needed to add a script.h header with:

Code: Select all

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

#if (LUA_VERSION_NUM > 501)

#define LUA_GLOBALSINDEX    LUA_RIDX_GLOBALS

#define luaL_reg	        luaL_Reg
#define luaL_putchar(B,c)   luaL_addchar(B,c)
#define lua_open            luaL_newstate

#endif // #if (LUA_VERSION_NUM > 501)
and redirect all script access through this file in the engine and add the missing

Code: Select all

LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
  const char *msg = lua_pushfstring(L, "%s expected, got %s",
                                    tname, luaL_typename(L, narg));
  return luaL_argerror(L, narg, msg);
}
to lauxlib.c and

Code: Select all

LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
to lauxlib.h in the Lua 5.2 distribution.

Are there some other hidden problems/bugs I'm not aware of?
Last edited by _ex_ on Thu Dec 29, 2011 12:30 am, edited 3 times in total.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Lua 5.2 released, is there a plan to use it?

Post by Robin »

Would you have a suggestion how to implement the sandbox of SELÖVE in Lua 5.2?
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests