LUA 语法问题

x = 10
local i = 1
while i<=x do
local x = i*2
print(x)
i = i + 1
end

提示错误:stdin:1: attempt to compare nil with number 这是怎么回事呀?

它的意思是你用数字跟nil值做了比较,自然得出了错误。
另外,你贴的代码我运行了,是没有问题的。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-04-24
error: attempt to compare nil with number
stack traceback:
1: function `x888888_UpdateHonorRecord' at line 2119 [string "?"]
2: function `x888888_CalculateHonor' at line 1871 [string "?"]
3: function `x888888_ProcMapPlayerDie' at line 2362 [string "?"]
OnScriptError 4:[1]
(09:22:17 269.220 47366499928535) Lua stack step leave error in fn : \system\systemmain.lua x888888_ProcMapPlayerDie 151 15000 15001
相似回答