此代码导致Corona无响应

时间:2017-02-28 23:56:37

标签: lua corona

当我在Windows 7上的Corona中运行此代码时,它会立即崩溃。它在ZeroBrane中运行良好。有什么想法吗?

--Stopwatch--

local startTime

function start()

startTime = os.time()
 --Start the stop watch--
end

function secondsEllapsed()
  --Return the number of seconds since the stop watch was started--
  return os.time() - startTime
end

start()

while true do

-- Get the time ellapsed and convert it to hours, minutes and seconds
ellapsed = secondsEllapsed()
hours = math.floor(ellapsed / 3600)
minutes = math.floor((ellapsed - (hours * 3600)) / 60)
seconds = math.floor((ellapsed - (hours * 3600) - (minutes * 60)))

-- Print the time ellapsed to the command line
print(hours .. 'h', minutes .. 'm', seconds .. 's')

  end

1 个答案:

答案 0 :(得分:-1)

崩溃可能是因为你运行了无限循环。