问题描述
我想比较一个函数返回的带有固定字符串的表条目。如果我先将结果存储在一个变量列表中,它将起作用。 为什么不可能将其作为单行表达式。有更好的方法吗?
-- similar to function provided by an API
local testFunction = function()
return true,{name = "hans"}
end
--works
local a = {testFunction()}
if a[2].name=="hans" then
--do something
end
--doesn't work
if {testFunction}[2].name=="hans") then
--do something
end
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)