lua-users home
lua-l archive

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


On 9/14/14, Thiago L. <fakedme@gmail.com> wrote:
> On 9/14/14, Peter Melnichenko <mpeterval@gmail.com> wrote:
>> 14.09.2014 21:33 "Thiago L." <fakedme@gmail.com>:
>>>
>>> For example:
>>>
>>> Lua 5.2.3  Copyright (C) 1994-2013 Lua.org, PUC-Rio
>>> > setmetatable(_ENV, {__newindex = function(t,k,v) if k == "out" then
>> io.write(v) end end}) out,out,out = "what","the","fuck"
>>> fuckthewhat>
>>>
>>
>> More magic:
>>
>>> local a, a, a = 1, 2, 3; print(a)
>> 3
>>> b, b, b = 1, 2, 3; print(b)
>> 1
>>
>
> Yeah, but at least it's consistent. that is, local x = 1; local x = 2;
> local x = 3; print(x) -> prints 3
>

(Side note: you should try using debug.getlocal with the local a,a,a
example/thing)