Download
(2 Kb)
Download
Updated: 07-16-13 04:32 AM
Pictures
File Info
Updated:07-16-13 04:32 AM
Created:07-16-13 04:32 AM
Downloads:80
Favorites:1
MD5:
Corout
Version: 1.0
by: Kheldar [More]
This library has been created to keep out of the watchdog easily. Instead of having to write the whole coroutine mechanic each time you have performance issues, you can use this. It permit to create a coroutine in a couple of lines.

To use it, just call corout(YourFunction) and it will start a coroutine running YourFunction automatically. You have to call corout.check() sometimes in your function to verify that the watchdog isn't about to cut of you addon.

It is recommended to add a label to all your corouts in order to be safe with others addons and your own addon when you use multiples corouts together. In addition, you're allowed to pass as much parameters as you wish after those ones. You may get something like corout(MyFunction, "Corout MyLabel", MyArg1, MyArg2, ...). You can also define another time remaining limit before watchdog alarm if you want to (default is 0.03).

Here is an example :

function example(arg1, arg2)
for foo, foo2 in pairs(arg) do
arg2[foo] = foo2
-- do something here

corout.check() -- check the watchdog state
end
end

corout(example, "Corout AddonIdentifier", arg1, arg2)

If you have any suggestion or feedback, i would be glad to hear it.
Optional Files (0)


There have been no comments posted to this file.
Be the first to add one.



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.