2
我試圖從值中獲取表鍵名。 tostring
只返回table: XXXXXXXXX
從值獲取表鍵名
我嘗試了一些功能,但沒有任何工作。
config = {
opt1 = "etc..."
}
players = {}
function openMenu(playerName, configTable)
players[playerName] = Something to get Table Key...
-- read the table and create a gui not yet made
end
而接下來,如果我這樣做:
print(players[playerName])
我想這樣的輸出:
"config"
PS:這需要用表的表工作(myTable的= {配置= {}}) –
可能重複[ Lua從值中找到一個鍵值](http://stackoverflow.com/questions/7925090/lua-find-a-key-from-a-value) – ryanpattison
不,它不是,我發現如何 –