lua-users home
lua-l archive

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


On Wednesday, May 06, 2015 02:48:01 PM Enrico Colombini wrote:
> My first try was a failure:
> 
>    -- this will not load on Lua 5.2 because of the '|'
>    local bor = bit32 and bit32.bor or function(a, b) return a | b end
> 
> So I added a new module:

Of course the other way to wrap a compatibility function with new syntax is

    local bor = bit32 and bit32.bor 
               or load[[return function(a, b) return a | b end]]()

But a module has its own obvious advantages.

-- 
tom <telliamed@whoopdedo.org>