lua-users home
lua-l archive

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


> On Nov 30, 2014, at 4:58 PM, Thiago L. <fakedme@gmail.com> wrote:
>> 
> Issues:
> 
> function() return ("").sub end -- Issue number 1: How am I supposed to get an environment out of this thing from the string metatable? (seeing as there's no _ENV and no way to access the env of the scope that created this function)

Not sure I understand this issue. The function will of course use whatever environment that was appropriate to it (in this case, the environment of the enclosing function). What do you want it to do?

> 
> do
>  local type = type
>  local _ENV = {print=print, tostring = function(i) if type(i) == "string" then return ("%q"):format(i) end return ("%s"):format(i) end}
>  print("Issue number 2: Uh oh! This doesn't get serialized!")
> end
> 

Again, what is the issue here? What problem are you trying to address?

—Tim