[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Compat-5.2: a tiny Lua module providing some Lua-5.2-style APIs for Lua 5.1
- From: Philipp Janda <siffiejoe@...>
- Date: Wed, 04 Sep 2013 18:08:06 +0200
Am 03.09.2013 22:09 schröbte Hisham:
Hi,
Hi!
Feedback, contributions, pull requests and criticism are welcome!
1) You do:
local unavailable = function() error("compat52: Do not use this
function. It is incompatible with Lua 5.2") end
setfenv = unavailable
getfenv = unavailable
This breaks code like
...
if setfenv then
setfenv( chunk, env )
end
...
which, I think, is a common idiom for code targeted at both Lua 5.1 and
5.2. See e.g. here[1] ...
[1]: http://comments.gmane.org/gmane.comp.lang.lua.general/99000
(It also breaks my preferred idiom (`if _VERSION == "Lua 5.1" ...`), but
since I cache all my globals I can just load my modules before
require'ing compat52.)
How about a warning on stderr that you can disable via an environment
variable instead of the error?
2) `table.unpack` is still available as a global `unpack` in Lua 5.2 if
`LUA_COMPAT_UNPACK` is defined.
-- Hisham
http://hisham.hm/
Philipp