lua-users home
lua-l archive

Re: The "Environment Stack" (+ lexically scoped string metatables)

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


Soni They/Them L. <fakedme@gmail.com> wrote:
>>> `"%s %s" % {"hello", "world!"}` without affecting other modules/the main program.
>> I am sorry, but I don't understand the backtick string you've posted?
> 
> getmetatable("").__mod = function(a, b)
> return string.format(a, table.unpack(b))
> end
Ah, okay, I get it now, thank you for the clarification! ;)
So the idea is that a module could be loaded and set that metatable and it
would then be active for the scope of that module only while not affecting
any of the other running code?
~Paige

AltStyle によって変換されたページ (->オリジナル) /