lua-users home
lua-l archive

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


Jerome Vuarand schrieb:
> One way to restrict such abusive uses, which can easily become a mess
> (I guess all agree on that), would have been to restrict
> setfenv/getfenv so they no longer can take their integer parameter,
> ie. they can only modified a function that is passed directly as a
> reference rather than a call stack index.

But "getfenv (2)" was exactly one of the features I used. (In order to
load a string into the environment of the caller rather than into the
global environment).

getfenv and setfenv operating on variables only wouldn't make it safer,
you could still break any other function you can reach. But on the other
hand, getmetatable (...) can damage a lot, too. You can just overwrite
the global variables of library functions. And so on.

- David