When I create a function by assignment, the if condition does not work, but when I create a function, as in the second example below, it works. Can you tell me why?
Does not work:
local start=os.time() local countDown = function(event) if((os.time()-start)==3) then Runtime: removeEventListener("enterFrame", countDown) end print(os.time()-start) end Runtime:addEventListener("enterFrame", countDown)
IN:
local start=os.time() local function countDown(event) if((os.time()-start)==3) then Runtime: removeEventListener("enterFrame", countDown) end print(os.time()-start) end Runtime:addEventListener("enterFrame", countDown)
source share