lua-users home
lua-l archive

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

Cosmin Apreutesei <> writes:
>> Writing code that runs under 5.1 / 5.2 / non-FFI-LuaJIT is
>> generally very easy, because differences are quite minor.
> I have 60 modules starting with setfenv(1, require'winapi') so that
> everything goes in the same namespace. What would be a reasonable
> migration option to 5.2 for this?

Maybe something like:

   local _ENV = require 'winapi'              -- handles 5.2
   if setfenv then setfenv (1, _ENV) end      -- handles 5.1


Patience, n. A minor form of despair, disguised as a virtue.