tab1 = {key1="aaa1","aaa2",key2="bbb"}
print(tab1.key1(1)) fail
print(tab1.key1{1}) fail
print(tab1.key1.1) fail
I cant retrieve second value of key 1..
tab1 = {key1="aaa1","aaa2",key2="bbb"}
print(tab1.key1(1)) fail
print(tab1.key1{1}) fail
print(tab1.key1.1) fail
I cant retrieve second value of key 1..
note that you have not set any keys to "key1" ! another note do you know how index and what table are? please read about them in lua doc.
it's just a normal table, you can use "next" or "pair", functions to print all values.
tab1 = {key1="aaa1","aaa2",key2="bbb"}
for key, value in next, tab1 do
print(key, value)
end
-- result:
-- [[
1 aaa2
key2 bbb
key1 aaa1
]]
if its a key then just use '.key1' or '["key"]' or its not a key then by default it's an index. eg:
print(tab1.key1) -- or tab1["key1"]
print(tab1[1])
print(tab1.key2) -- or tab1["key2"]
and if you want to save more than a key inside another key simple make another table inside that key.
tab1 = {
key1 = {'a', 'b', 'c'}
}
print(tab1.key1[1])
print(tab1.key1[2])
print(tab1.key1[3])
sorry if i did not explain it well enough.