lua-users home
lua-l archive

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


On Sun, May 19, 2013 at 4:07 PM, Lorenzo Donati
<lorenzodonatibz@tiscali.it> wrote:
> Just to be sure: is LPeg12 still compatible with Lua 5.1.5 or I'd need to
> upgrade to Lua 5.2.x.

It is still compatible with v5.1

in lptype.h:

    /*
    ** compatibility with Lua 5.2
    */
    #if (LUA_VERSION_NUM == 502)

    #undef lua_equal
    #define lua_equal(L,idx1,idx2)  lua_compare(L,(idx1),(idx2),LUA_OPEQ)

    #undef lua_getfenv
    #define lua_getfenv    lua_getuservalue
    #undef lua_setfenv
    #define lua_setfenv    lua_setuservalue

    #undef lua_objlen
    #define lua_objlen    lua_rawlen

    #undef luaL_register
    #define luaL_register(L,n,f) \
        { if ((n) == NULL) luaL_setfuncs(L,f,0); else luaL_newlib(L,f); }

    #endif

-- Pierre-Yves