lua-users home
lua-l archive

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

Edgar Toernig wrote:
Hm... just my 2c: I was never comfortable with the whole fenv concept
(each function carries its own table of globals).  IMHO it's too clever
and produces more confusion then it gives features.  I saw not one use of
it that did not trigger my "dirty hack" radar.

It's great for sandboxes. I have an application where environments are carried around and user functions are executed into them at different times. It is very convenient to give the user the ability to just write:

  a = 3

instead of something more confusing such as:

  usertable.a = 3

Besides, with setfenv() user functions can't modify other variables.
Do you see a way of getting this (efficiently) without setfenv?