local t = "{{2173,1},{2160,5}}"
print(#t) -- 19?? wrong
如何转换为出现在数字中?
local t = {{2173,1},{2160,5}}
print(#t) -- 2 correct
您可以通过load
or运行字符串loadstring
(取决于您的 Lua 版本),这将返回您要查找的表:
local t = "{{2173,1},{2160,5}}"
t = (loadstring or load)("return "..t)()
print(#t) -- 2
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句