local keyset={}
local n=0
for k,v in pairs(tab) do
n=n+1
keyset[n]=k
end
Note that you cannot guarantee any order in keyset. If you want the keys in sorted order, then sort keyset with table.sort(keyset).
local keyset={}
local n=0
for k,v in pairs(tab) do
n=n+1
keyset[n]=k
end
Note that you cannot guarantee any order in keyset. If you want the keys in sorted order, then sort keyset with table.sort(keyset).