Built Lua 5.1 on Debian testing on Compaq DeskPro then built random
module from LuaForge. The build of random fails when it tries to run the
test script. Here is the output.
make
cc -I/usr/local/include -ansi -pedantic -Wall -O2 -c -o lrandom.o lrandom.c
cc -o lrandom.so -shared lrandom.o
/usr/local/bin/lua -lrandom test.lua
/usr/local/bin/lua: ./random.lua:7: attempt to call global 'loadlib' (a nil
value)
make: *** [test] Error 1
Modified lua-5.1/src/luaconf.h to define LUA_COMPAT_LOADLIB.
/*
@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
** CHANGE it to undefined as soon as you do not need a global 'loadlib'
** function (the function is still available as 'package.loadlib').
*/
#define LUA_COMPAT_LOADLIB
The test script now works.
The comment implies that we may need a global 'loadlib' for a while and that
we can do without it later.
Is LUA_COMPAT_LOADLIB required with random because it is not compatible with
Lua 5.1 or did I misunderstand the comment and the purpose of the
LUA_COMPAT_LOADLIB macro? If it's the first, how can random be made
compatible? If it's the latter, please explain the meaning of the macro.