I know this question isn't related to the Lua language itself, but
rather to various linux distributions and how the Lua library is made
available on them; but I hope I can get some help here anyway.
My problem is that I've recently started getting quite a lot of bug
reports from people who complain my game won't compile anymore, due to
some Lua issues. I've figured out what all those people have in
common, namely the fact that they've just upgraded from Lua 5.0 to Lua
5.1. I know it's not Lua's fault that some Linux distributions don't
offer packages like liblua50 and liblua51, but instead just have a
single package called something like liblua; it's annoying none the
Currently my configure (autoconf) script works by looking for both
liblua and liblua50, and simply links with anything it can find, and
includes any header files it can find (sometimes found in #include
<lua50/*>, sometimes found in #include <lua/*>, and sometimes found
only in #include <*>).
This worked fine when everybody was just using Lua 5.0, but now some
people are using Lua 5.1 which isn't backward compatible.
Of course I could just use the new Lua libraries instead (i.e. stop
using some macros), but what when Lua 5.2 comes out and it's the same
problem all over again? And, frankly, I don't feel like changing stuff
in my current code, as it works fine as it is. (if there's
security/bug-fixes in Lua 5.1, I hope they're released for Lua 5.0
too, so people don't need to change API to be up to date).
Another thing is that my game project might not be as active when Lua
5.2 comes out, so maybe there'll be none to fix it.
I hope there's a neat way to handle this problem, and maybe someone
who can redirect me to some autoconf code which can do it. Well, is
Here's a snippet from my configure.in:
AC_SEARCH_LIBS(lua_pushboolean,lua lua50, , [AC_MSG_ERROR(liblua50
or liblua required)])
AC_SEARCH_LIBS(luaopen_math,lualib lualib50, ,
[AC_MSG_ERROR(liblualib50 or liblualib required)])
Google told me it was removed in Lua 5. The correct name is luaL_checknumber. I found that in 5.0.2 sources:
lua-5.0.2/include/lauxlib.h:132:#define luaL_check_number luaL_checknumber
I guess there it's a compability macro in 5.0 that has been removed in 5.1. luaL_checknumber is ok in 5.0 too, so if you don't need Lua4.x support use the luaL_check* instead of luaL_check_*.
De : [hidden email] [mailto:[hidden email]] De la part de Rasmus Neckelmann
Envoyé : 30 mai 2006 15:10
À : Lua list
Objet : Re: Linking with Lua the best way
On 5/30/06, Luiz Henrique de Figueiredo <[hidden email]> wrote:
> Your best bet is to link Lua statically into your program. To ensure
> you have the correct version, distribute Lua with your program.
I did that originally, but then some linux package maintainers started complaining that all programs should link dynamically with libraries
Of course, if that's the best bet I'll consider it again.
> BTW, why doesn't your program compile and run fine under Lua 5.1?
Specifically it complains about lack of luaL_check_number (and possibly other macros). Some googling told me that this macro have been removed from Lua 5.1.