lua-users home
lua-l archive

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


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