lua-users home
lua-l archive

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

On 04/03/17 02:52 PM, Dirk Laurie wrote:
2017-03-04 18:59 GMT+02:00 <>:
i'm following luajit on the mailing list of it and on github, it's not
dead, they are working hard on a lotsa things, but Mike isn't planning
to follow everything that appears in lua. there are some forward
compatibilities for lua5.2 and 5.3, but it's currently not planned to
follow up lua to 5.3
Impression I got is that _ENV is no-no but almost everything else
(binary operators, utf8, string.pack etc) has got or will get into LuaJIT.

Write some code to use _ENV on every global access and append `local _ENV = _ENV or getfenv()` before everything you load, then replace load().

As in,

print(table.unpack {1,2,3})


local _ENV = _ENV or getfenv()
_ENV.print(_ENV.table.unpack {1,2,3})

after going through your code.

This is roughly equivalent to 5.2/5.3 semantics. (except for passing `nil` to _ENV since setfenv/getfenv don't support nil for some reason... maybe setfenv(f, {getfenv=function() returnn nil end}) ? note that this solution isn't perfect.)

Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.