运行脚本出现 invalid key to "next" 的报错,一般是由于在循环里对 table 中的内容赋值错误或者置空的操作。
错误示例详见下方代码
|
1 2 3 4 5 6 7 8 9 10 11 12 |
function 判断控件(text, delay, attr, rule) attr = attr or "text" rule = rule or 0 local wid = widget.find({ [attr] = text, ["rule"] = rule }) if wid ~= nil then mSleep(1000*delay) end end --正确写法 --判断控件("去听歌",5,"text") --错误写法 判断控件("text","去听歌",5) |