MadSysop
Chieftain
- Joined
- Jun 24, 2017
- Messages
- 6
Hi
I'm trying to use the timer module (https://docs.coronalabs.com/api/library/timer/performWithDelay.html) inside lua script. I have tried, but failed with error "function expected instead of nil" on the line, where I call "timer.performWithDelay(1000, listener)". Could the timer be restricted by Civ or I'm doing something incorrectly?
I have loaded the file as VFS=true.
--------------------------
local timer = include( "timer" )
if timer == nil then
print("timer is nil")
else
print("timer exists")
end
function listener( event )
print( "listener called" )
end
function OnPlayerDoTurn(iPlayer)
print("Running OnPlayerDoTurn for " .. iPlayer)
timer.performWithDelay( 1000, listener )
end
GameEvents.PlayerDoTurn.Add(OnPlayerDoTurn)
--------------------------
I'm trying to use the timer module (https://docs.coronalabs.com/api/library/timer/performWithDelay.html) inside lua script. I have tried, but failed with error "function expected instead of nil" on the line, where I call "timer.performWithDelay(1000, listener)". Could the timer be restricted by Civ or I'm doing something incorrectly?
I have loaded the file as VFS=true.
--------------------------
local timer = include( "timer" )
if timer == nil then
print("timer is nil")
else
print("timer exists")
end
function listener( event )
print( "listener called" )
end
function OnPlayerDoTurn(iPlayer)
print("Running OnPlayerDoTurn for " .. iPlayer)
timer.performWithDelay( 1000, listener )
end
GameEvents.PlayerDoTurn.Add(OnPlayerDoTurn)
--------------------------