[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [bug?] LUA_COMPAT_BITLIB can not enable separately
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 11 Nov 2015 16:48:51 -0200
> We use Lua 5.3.1 in our project's server, but in client we use UniLua
> which compatible with Lua 5.2.
>
> After we use bit32 library, we found that to define LUA_COMPAT_BITLIB
> cause compile error: bit32 library use luaL_checkunsigned, which is
> already deprecated already. to use it, we should also define
> LUA_COMPAT_APIINTCASTS.
>
> So, it's needed to remove use of luaL_checkunsigned, or define
> LUA_COMPAT_APIINTCASTS when luaconf.h found LUA_COMPAT_BITLIB defined?
Thanks for the report. My suggestion is to fix the library itself,
for instance with something like this:
#if !defined(lua_pushunsigned)
#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n))
#endif
#if !defined(luaL_checkunsigned)
#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a))
#endif
We will fix that in the next release of Lua 5.3.
-- Roberto