|
On 25/11/14 10:57 AM, Kang Hu wrote:
In Programming in Lua, Third Edition: Exercise 2.6: Assume the following code: a = {}; a.a = a 1. What would be the value of a.a.a.a ? Is any a in that sequence somehow different from the others? 2. Now, add the next line to the previous code: a.a.a.a = 3 What would be the value of a.a.a.a now? my reasoning is 1. a.a.a.a = ((a.a).a).a = (a.a).a = a.a = a 2. with the the previous reasoning, 'a' should be 3. but actually, 'a.a' equals 3 and 'a' is a table. why?
a = {} _G.a.a = a a.a.a.a = 3 print(_G.a.a) -- Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.