Page 1 of 4

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

Posted: Sat Dec 17, 2011 5:10 pm
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

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

Posted: Sat Dec 17, 2011 5:43 pm
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

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

Posted: Sat Dec 17, 2011 6:17 pm
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.

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

Posted: Sat Dec 17, 2011 7:02 pm
by pk
Note that you can start compiling Lua 5.2 with LÖVE right now and start reporting what breaks.

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

Posted: Sat Dec 17, 2011 11:17 pm
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.

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

Posted: Sun Dec 18, 2011 10:00 am
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?

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

Posted: Sun Dec 18, 2011 11:19 am
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.

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

Posted: Tue Dec 27, 2011 7:14 pm
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.

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

Posted: Wed Dec 28, 2011 7:32 pm
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?

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

Posted: Wed Dec 28, 2011 8:07 pm
by Robin
Would you have a suggestion how to implement the sandbox of SELÖVE in Lua 5.2?