lua-users home
lua-l archive

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



suppose I wanted to make a bit64 library with Lua 5.3 and
LuaJIT implementations

Using a "bit64" library in Lua 5.3
function bit64.bor(a,b) return a|b end
would be 10 times slower than native 5.3 code.

The only sane way I see to make a script for both
Lua 5.3 and LuaJIT is to include two versions of the script
in one lua file and choose version-specific branch in runtime.

I recently started using GPP as a preprocessor in a Lua project just for that one purpose. I have macros that either translate into binary ops or bit functions, depending on the target being LuaJit or Lua 5.3. 


--
Sent from my phone