lua-users home
lua-l archive

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


>From: Norman Ramsey <nr@cs.virginia.edu>
> A bunch of my code is breaking under version 3.1 that worked under 3.0.

In a private mail, Norman told me:

>The following names were undefined
>
>  iolib_open
>  strlib_open
>  lua_getsubscript
>  lua_storeglobal
>
>The first two may be my fault, because I don't think I include
>lualib.h.  The latter two with #defines in 3.0 but not apparently in 3.1.

Just to reassure everyone: *nothing* is really being broken.
All you need is to #define LUA_COMPAT2_5 (which was on by default in 3.0,
but no longer on in 3.1).

Here's is my answer to Norman, which I think might be useful to others.

Since 3.0, iolib_open and strlib_open are called lua_iolibopen and
lua_strlibopen. There are #defines for this in lualib.h.
However, lua_iolibopen and lua_strlibopen are the official names.

In 3.1, the #defines for lua_getsubscript and lua_storeglobal (and others)
are still in lua.h, but you have to explicitly #define LUA_COMPAT2_5 to
get them. In 3.0, LUA_COMPAT2_5 was #define'd to be 1. This has changed in 3.1,
and LUA_COMPAT2_5 is left undefined.

So, bottom line: add -DLUA_COMPAT2_5 to you Makefile if you really need to
use the names lua_getsubscript and lua_storeglobal.
However, I suggest that you use the official names lua_gettable and
lua_setglobal.

--lhf