-
Posted by Flash2k6 on Mon, 07 Sep 2009 19:19:58
In your simple timer, how would you handle local functions being passed to it, instead of globals?
For example if I do:
SimpleTimingLib_Schedule(5, print, "Some message")
it works fine and prints the message in 5 seconds.However if I write a function called "MyProgressMeter(val1, val2)" and try this:
SimpleTimingLib_Schedule(10, MyProgressMeter(val1, val2))
It fails, and val.func = nil when the 10 seconds comes around. Also, MyProgressMeter executes right away as well.
How would I pass my own functions into the scheduler instead of standardized functions like print?
Thanks
-
Posted by jnwhiteh on Mon, 07 Sep 2009 19:49:08
In your simple timer, how would you handle local functions being passed to it, instead of globals?
For example if I do:
SimpleTimingLib_Schedule(5, print, "Some message")
it works fine and prints the message in 5 seconds.However if I write a function called "MyProgressMeter(val1, val2)" and try this:
SimpleTimingLib_Schedule(10, MyProgressMeter(val1, val2))
It fails, and val.func = nil when the 10 seconds comes around. Also, MyProgressMeter executes right away as well.
How would I pass my own functions into the scheduler instead of standardized functions like print?
Thanks
I'm not really sure what you're referring to. Chapter 4 doesn't contain any library called SimpleTiming, so I'm a but confused.
From what I can see, it looks like the SimpleTimingLib_Schedule takes in a time, a function and a list of arguments to be passed. In this case, you'd want to do something like this:
SimpleTimingLib_Schedule(10, MyProgressMeter, val1, val2)
Does that make sense?
-
Posted by jnwhiteh on Mon, 07 Sep 2009 19:50:56
It appears that you're referring to another book about writing WoW addons. I'll do my best to help you fix your errors, but I'm a bit limited since I'm not the author of the book. Thanks!
-
Posted by Flash2k6 on Mon, 07 Sep 2009 21:18:07
Yes, I'm retarded, I posted this on the wrong forum. Too many damn programming windows open, sorry bout that.
-
Posted by jnwhiteh on Mon, 07 Sep 2009 21:26:08
No worries at all! Hope my explanation helped either way!