lua-users home
lua-l archive

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


On Mon, Apr 14, 2014 at 7:01 PM, Aapo Talvensaari
<aapo.talvensaari@gmail.com> wrote:
> returns "string"). This is what I'm after. To patch that function to all the
> strings that are used this point forward, but patches released after this
> scope ends (e.g. no global changes, only local string changes).

Alas, but no Lua mechanism exists to perform some action at scope end;
will have to explicitly restore string state.  If we had deterministic
finalizers[1]  then it would be straightforward.

Another idea that was floating around is that the metatable of
strings, etc could be tied to the current environment[2].  Then a
person could happily monkey-patch within their modules without any
other code being bothered.

[1] yes, there's a patch out there
[2] in 5.2 terms, whatever _ENV is pointing to...