[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Status of 5.2 ports
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 8 Nov 2011 08:54:20 -0200
> Can the C preprocessor make the situation easier here, at least for
> relatively simple libraries?
>
> It's a bother looking after different versions of the source.
Sure, that's a problem. When we moved to 5.1 I changed my libraries to
work with both 5.0 and 5.1 and distributed a single package. Since then
I've created packages for 5.1 for almost all my tools. For 5.2 I think
I'll start with the same source but keep separate packages. In any case,
the changes are fairly minor, typically this:
==> 5.1/lrandom.c <==
LUALIB_API int luaopen_random(lua_State *L)
{
luaL_newmetatable(L,MYTYPE);
lua_setglobal(L,MYNAME);
luaL_register(L,MYNAME,R);
...
==> 5.2/lrandom.c <==
LUALIB_API int luaopen_random(lua_State *L)
{
luaL_newmetatable(L,MYTYPE);
luaL_setfuncs(L,R,0);
#ifdef EXPORT_GLOBAL
lua_pushvalue(L,-1);
lua_setglobal(L,MYNAME);
#endif
...
diff -u 5.1/test.lua 5.2/test.lua
-require"random"
+local random=require"random"