【发布时间】:2015-10-01 17:04:45
【问题描述】:
我正在尝试从一个值中获取表键名。
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"
【问题讨论】:
-
P.S : 这需要使用表的表 (myTable = { config = {} })
-
Lua find a key from a value 的可能重复项
-
不,不是,我找到了方法
-
似乎没有人完全理解您的问题,正如这里的答案和赞成票所暗示的那样。你能澄清你的问题的区别吗?
-
我要重新解释一下。我有一个变量,我想得到他的名字(变量是一个表)