✓ Accepted answer
If you simply want the indexes, then you should be printing i, not v If you needed to print in the values inside of i, then you would simply unpack it.
The reason why it is printing table's memory location is because
I) You are printing the value of index, not the index itself
II) Simply because you are printing the table, which if you wanted to get it's value, you would have to unpack it. You have a matrix. That is why.
local Rarities = {
["Common"] = {"Oof1", "Oof2"},
["Common2"] = {"Oofa", "Oofb"},
}
for i, v in pairs(Rarities) do
print(i)
print(unpack(v));
end
would print
Edit: Whoops forgot Lua 5.1 uses unpack not table.unpack.
1 comment
Works like a dream! Thank you!