lua-users home
lua-l archive

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


I'm working with a  library, lua-zip [1] that is a binding to libzip [2].
I would like to make sure that the library remains compatible with
Lua 5.1, 5.2, and 5.3, if possible.

lua-zip was written for Lua 5.1, and does not compile under Lua 5.2,
5.3 because the following functions are missing:
lua_equal, luaL_checkint, lua_objlen, luaL_register

I understand that I can use compatibility macros or replace lua_equal,
luaL_checkint, lua_objlen myself, so they are not the problem.

The problem is with luaL_register. With 5.3, it is an alias for
luaL_openlib, that is exported only if LUA_COMPAT_MODULE is defined
during compilation, which neither Debian nor Homebrew seem to do.

So, when I do `local zip = require ""`, I get this

/usr/local/share/lua/5.3/luarocks/loader.lua:153: error loading module
'' from file
    /home/user/.luarocks/lib/lua/5.3/brimworks/ undefined
symbol: luaL_checkint
stack traceback:
    [C]: in local 'a_loader'
    /usr/local/share/lua/5.3/luarocks/loader.lua:153: in function
    (...tail calls...)
    [C]: in function 'require'
    stdin:1: in main chunk
    [C]: in ?

What would be a good, and clean way to fix this ? Should I copy/paste
the code from lauxlib? How can I disable this compatibility code if
I'm compiling for 5.2 or lower?

I hope I have everything right.


Thank you,

-- Antonin Décimo