2017-02-28 79 views
-1

當我在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

它不會讓你發佈,因爲沒有足夠的解釋來使它有任何意義。歡迎來到SO。請看[遊覽]。您可能還想檢查[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)和[問],以及如何創建[mcve]。發佈您嘗試過的代碼以及收到的錯誤。儘可能具體,因爲它會導致更好的答案。 – happymacarts

回答

-1

它崩潰可能是因爲你運行無限循環。