[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [5.2+] Can a function access/modify/replace its caller's _ENV?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sat, 22 Dec 2018 09:47:32 +0200
Op Sa. 22 Des. 2018 om 05:48 het Jonathan Goble <email@example.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
> and/or replace that table with a new one?
> 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?