lua-users home
lua-l archive

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


Op Sa. 22 Des. 2018 om 05:48 het Jonathan Goble <jcgoble3@gmail.com> geskryf:
>
> Can a function (Lua or C) in Lua 5.2+ gain access to its caller's _ENV,

Only as an upvalue, and even then, only if your function refers to it,
e.g. via a global name.

> and if so, can it modify that table

Yes.

> and/or replace that table with a new one?

No.

> What I'm looking for is an approach that allows all three (access, modify, and replace) without writing "_ENV" (or the name of any variable that refers to _ENV) anywhere in the statement that calls the function.
> Any thoughts on how to do this? Or is it not possible?

Do you grant me the debug library?