Jump to content

addEventHandler -argument 3


-Jigsaw

Recommended Posts

What I got:

addEventHandler("onResourceStart", root, startTimer) 
  
function startTimer() 
    if not question then 
        tInterval = math.random(180000, 360000) 
        setTimer(postQuestion, tInterval, 1) 
    end 
end 

What I get:

Bad argument @ ' addEventHandler'[Expected function at aergument 3, got nil] 

Anybody knows what's wrong :? I seriously don't see nothing being wrong

Edited by Guest
Link to comment

The event handler should go after the function creation.

function startTimer() 
    if not question then 
        tInterval = math.random(180000, 360000) 
        setTimer(postQuestion, tInterval, 1) 
    end 
end 
addEventHandler("onResourceStart", resourceRoot, startTimer) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...