1
調用元表功能我有這樣的功能:的Lua:從字符串
function Bootstrap: test()
-- CODE HERE
end
我會調用此函數,從它的名字。
這個例子的工作原理:
function callFunc()
c = "Bootstrap"
_G[c].test()
end
我需要做這樣的事情:
function callFunc()
c = "Bootstrap"
f = "test"
_G[name].[f]() -- Bootstrap.test()
end
但有一個錯誤:
'<name>' expected near '['
我該怎麼辦?謝謝。