Trying to understand exercise 5.1 in Programming in Lua, fourth edition
The code is included, but I don't understand what's going on
sunday = "monday" ; monday = "sunday"
print("After first line ", sunday, monday)
t = {sunday = "monday", [sunday] = monday}
print("Printing #t", #t)
for k = 1 , #t do
print(k, t[k])
end
print("After printing ipairs")
print(t.sunday, t[sunday], t[t.sunday])
The results I'm getting are as follows:-
After first line monday sunday
Printing #t 0
After printing ipairs
monday sunday sunday
It's basically line 3 that is confusing me. Why are the number of elements in t zero ??