I have been trying things out in a small test program I made to narrow down what I was struggling with:
t = {}
function setit(cid)
t[cid] = "somevalue"..cid
end
print("13 Table size was "..table.getn(t))
setit(13)
print("13 Table size is now "..table.getn(t))
textutils.tabulate(t)
print("1 Table size was "..table.getn(t))
setit(1)
print("1 Table size is now "..table.getn(t))
print("15 Table size was "..table.getn(t))
setit(15)
print("15 Table size is now "..table.getn(t))
textutils.tabulate(t)
This gives me the following output:
13 Table size was 0 13 Table size is now 0 1 Table size was 0 1 Table size is now 1 15 Table size was 1 15 Table size is now 1 somevalue1
I was expecting this to set all three keys actually, based on the examples I have found etc. Could one of the pros (or maybe even noobs?) give me a hint as to what I have misinterpreted about hos Tables work in Lua ?












