749 posts
Location
BOO!!
Posted 13 April 2016 - 08:38 PM
I have a table
{
['i']=0,
['o'] = 1
}
Can I get the index names rather than the index value?
2679 posts
Location
You will never find me, muhahahahahaha
Posted 13 April 2016 - 08:44 PM
yes.
for i,v in pairs(tabl)
– i is index
end
749 posts
Location
BOO!!
Posted 13 April 2016 - 08:45 PM
yes.
for i,v in pairs(tabl)
– i is index
end
Thanks
463 posts
Location
Star Wars
Posted 13 April 2016 - 09:07 PM
You can save code:
function getIndex(tab, value)
local indexes = {}
for index, var in pairs(tab) do
if var == value then
table.insert(indexes, index)
end
end
return table.unpack(indexes)
end