lua-users home
lua-l archive

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




Soni "They/Them" L. <fakedme@gmail.com>于2019年5月7日 周二02:17写道:


On 2019-05-05 11:03 p.m., 云风 Cloud Wu wrote:
> Soni "They/Them" L. <fakedme@gmail.com> 于2019年5月5日周日 上午11:05写道:
>> I often write code like:
>>
>> local foo = t.foo
>> if not foo then foo = whatever t.foo = foo end
>> -- use foo here
>>
>> but ideally I'd like to write it like:
>>
>> if not t.foo then t.foo = whatever end
>> local foo = t.foo

But your codes are not equivalence because it may trigger metamethods.



--
http://blog.codingnow.com