[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: `string.unpack` 's bug in option `z`
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 3 Sep 2018 09:03:25 -0300
> I object: people should be writing against the newest lua version
> available at the time, and using the preprocessor to gain *backwards*
> compatibility.
That's what I've done in the newer versions of my libraries, which now
work for Lua 5.x. I #include mycompat.h, which contains code like this:
#if LUA_VERSION_NUM <= 501
#define luaL_setmetatable(L,t) \
luaL_getmetatable(L,t); \
lua_setmetatable(L,-2)
#define luaL_setfuncs(L,r,n) \
luaL_register(L,NULL,r)
#endif
For a more general solution, see
https://github.com/keplerproject/lua-compat-5.3