Jump to content

just a question about DoTaskInTime


Recommended Posts

49 minutes ago, dois raios said:

If i put like this

inst.DoTaskInTime(2, myfunction, 3)

Does it mean my function will happen after 3 seconds?

No, it will error as it is with the dot syntax.  Presuming you fix that to be inst:DoTaskInTime, then it'll run after 2 seconds and run myfunction with arguments (inst, 3) passed into it.
You can read more into the behaviour of this in scripts/entityscript.lua and scripts/scheduler.lua.  The initial delay part works for DoPeriodicTask.
inst:DoPeriodicTask(2, myfunction, 3) will invoke the timer after 3 seconds, and then repeat every 2 seconds, and pass only (inst) to the callback myfunction.

  • Like 2
Link to comment
Share on other sites

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
 Share

×
  • Create New...