lua-users home
lua-l archive

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


On Wed, May 23, 2012 at 1:35 AM, Miles Bader <miles@gnu.org> wrote:
> Cosmin Apreutesei <cosmin.apreutesei@gmail.com> 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

Hm, that's actually not that bad. Thanks.

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