Thread Tools Display Modes
04/01/14, 09:31 PM   #1
Dio
 
Dio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
Tip - Found an asychronous timer function.

zo_callLater takes two arguments, in order: function, and delay in milliseconds. (LIke setTimeout in JavaScript)

Example:

Code:
/script zo_callLater(function() d("5 seconds have past!") end, 5000)
Stumbled upon this using /zgoo in the zo_Helper area.
  Reply With Quote
04/02/14, 11:39 AM   #2
DewiMorgan
 
DewiMorgan's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 14
Is there a list of such functions on the wiki somewhere?
  Reply With Quote
04/03/14, 12:59 PM   #3
ins
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 76
Great find
  Reply With Quote
04/12/14, 10:03 AM   #4
Ouijan
 
Ouijan's Avatar
Join Date: Apr 2014
Posts: 13
Smile

Cheers Dude thats handy!
  Reply With Quote
04/14/14, 07:13 AM   #5
ckaotik
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 12
Originally Posted by DewiMorgan View Post
Is there a list of such functions on the wiki somewhere?
I don't think there is a dedicated list for these (yet) but they can all be found in the global table
  Reply With Quote
04/14/14, 11:46 AM   #6
Dio
 
Dio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
If you're an addon developer, get zgoo. It's essential. Helper functions are under "zo_Helper" when you run /zgoo

Additionally, that globals wiki page is good. I cross-reference between the two constantly when developing.

Edit - while on the topic, what would be really useful is a wiki page of a globals dump that goes down 2 or 3 levels. e.g. If there is a table, expand the table down 2 or 3 levels.

I've tried to obtain this information recursively using "for x, y in pairs(_G)" but the "private function" errors are blocking.

Last edited by Dio : 04/14/14 at 11:52 AM.
  Reply With Quote
04/14/14, 12:03 PM   #7
Errc
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 30
Originally Posted by Dio View Post
If you're an addon developer, get zgoo. It's essential. Helper functions are under "zo_Helper" when you run /zgoo

Additionally, that globals wiki page is good. I cross-reference between the two constantly when developing.

Edit - while on the topic, what would be really useful is a wiki page of a globals dump that goes down 2 or 3 levels. e.g. If there is a table, expand the table down 2 or 3 levels.

I've tried to obtain this information recursively using "for x, y in pairs(_G)" but the "private function" errors are blocking.
Look in Zgoo. There is a function in there that will allow you to iterate _G safely. I think it is safepairs and that is how we iterate it. Uses some trickery with pcalls and parsing the error messages to avoid the private/protected functions without error.
  Reply With Quote
04/14/14, 12:07 PM   #8
Dio
 
Dio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
Originally Posted by Errc View Post
Look in Zgoo. There is a function in there that will allow you to iterate _G safely. I think it is safepairs and that is how we iterate it. Uses some trickery with pcalls and parsing the error messages to avoid the private/protected functions without error.
Thanks, I'll try this when I get home. If I can extract all the information I may create a new Wiki page that has 2-3 levels deep of globals. I don't want to amend the current one because it is already really slow to load.
  Reply With Quote
05/12/14, 03:58 AM   #9
Swizzy
 
Swizzy's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 2
** Ignore me **

Last edited by Swizzy : 05/12/14 at 04:06 AM.
  Reply With Quote
05/12/14, 04:12 AM   #10
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
** ok, ignoring **
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Tip - Found an asychronous timer function.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off