lua-users home
lua-l archive

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


On 8 November 2011 21:54, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> ==> 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"
>
>

Why not have an EXPORT_GLOBAL for both 5.1 and 5.2? (defaults on for
5.1; off for 5.2)
I'd rather my 5.1 libraries didn't make a global.