lua-users home
lua-l archive

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


On Tue, May 10, 2016 at 12:50:08PM -0400, Sean Conner wrote:
> won't work as intended in Lua 5.1 or 5.2 because of the new |
> operator in Lua 5.3.

The use of load() solves this specific case, no?

if _VERSION == "Lua 5.3" then
  bor = load("return function(a, b) return a | b end")()
elseif _VERSION == "Lua 5.2" then
  bor = bit32.bor
else
  bor = function(a, b) return a + b end
end

Peter