AshitaXI / Ashita

Issue tracker and wiki for the Ashita project.
https://ashitaxi.com/
6 stars 1 forks source link

Add Coroutine Returns To `ashita.tasks` Functions #24

Open atom0s opened 2 years ago

atom0s commented 2 years ago

Addon / Plugin Description

When creating a task from Ashita's ashita.tasks. addon functions, the actual created task/coroutine is not returned. It would be ideal to return the object so that users can easier control the coroutine (when applicable) such as killing it from outside the function.

For example:

local co = ashita.tasks.once(1, function ()
    -- do stuff here..
end);

co:kill(); -- Kill the coroutine, similar to coroutine.kill() from within the task function.

Or allow coroutine,kill() to accept an optional parameter of an existing coroutine/task.