这段代码导致 Corona 无响应

在 Windows 7 上在 Corona 中运行此代码会立即崩溃。在 ZeroBrane 中运行正常。有什么想法吗?

--Stopwatch--

local startTime

function start()

startTime = os.time()
 --启动秒表--
end

function secondsEllapsed()
  --返回从启动秒表以来经过的秒数--
  return os.time() - startTime
end

start()

while true do

-- 获取经过的时间并将其转换为小时、分钟和秒
ellapsed = secondsEllapsed()
hours = math.floor(ellapsed / 3600)
minutes = math.floor((ellapsed - (hours * 3600)) / 60)
seconds = math.floor((ellapsed - (hours * 3600) - (minutes * 60)))

-- 将经过的时间打印到命令行
print(hours .. 'h', minutes .. 'm', seconds .. 's')

  end
点赞
用户7026995
用户7026995

It crashes probably because you run infinity loop. 可能崩溃是因为你运行了无限循环。

2017-03-01 09:07:02