lua-users home
lua-l archive

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


Hi all,

Just want to gauge feeling on this issue. Currently, pl.utils acts as a 5.1/5.2 compatibility layer, and so it alters the global state.  Let my friend lglob express the situation, running in 5.1

lglob: pl\utils.lua:19: redefining global unpack  (if 5.2)
lglob: pl\utils.lua:20: redefining global loadstring (if 5.2, make it an alias for load)
lglob: pl\utils.lua:243: redefining global setfenv  (if 5.2)
lglob: pl\utils.lua:258: redefining global getfenv (if 5.2)
lglob: pl\utils.lua:287: redefining global table.pack (if 5.1)
lglob: pl\utils.lua:292: redefining global package.searchpath (if 5.1)

The glaring issue is that it defines set/getfenv for 5.2, and I think that this should become utils.getfenv, just as utils.execute is a more-portable form of os.execute.

Not sure about table.pack and package.searchpath. Useful for compatibility, but I wonder if doing it always is being sneaky.

(PL should move to a more capability-driven model here anyway, since LuaJIT defines package.searchpath for us anyway)

But what's the general feeling about this (sneaky) way to support portable code?

steve d.