有没有办法检索表的名称?例如,从这张表中我只想提取键名称" Mimic"," Molibdeno"," Tamarindo"," Wrenna"
UnitScanDB = {
profiles = {
Mimic = {
...
},
Molibdeno = {
...
},
Tamanrindo = {
...
},
Wrenna = {
...
}
}
}
答案 0 :(得分:3)
for k in pairs(UnitScanDB.profiles) do
-- handle k
end
使用上述循环,您可以将所有键复制到新表中:
local names = {}
for k in pairs(UnitScanDB.profiles) do
table.insert(names, k)
end
答案 1 :(得分:0)
您只需按名称访问这些键即可:
mimic = UnitScanDB.profiles.Mimic
molibdeno = UnitScanDB.profiles.Molibdeno