coro

Coroutine manager for SkyOS. Might work, might not, who knows.

corosCurrently running coroutines.
activeCorosCurrently active coroutines, with pid as key.
newCoro(func [, name [, parent [, env [, forceActive]]]])Make a new coroutine and add it to the currently running list.
killCoro(coro)Kill a coroutine, and remove it from the coroutine table.
runCoros()Run the coroutines.
stop()Stop the coroutine manager, halting all threads after current loop.
resume(pid, ...)Resume a coroutine with a custom event, with error handling and such.
corosSource

Currently running coroutines. This is stored in SkyOS.coro.coros

activeCorosSource

Currently active coroutines, with pid as key.

newCoro(func [, name [, parent [, env [, forceActive]]]])Source

Make a new coroutine and add it to the currently running list.

Parameters

  1. func function Function to run forever.
  2. name? string Name of the coroutine, defaults to coro.
  3. parent? number Parent PID, mirrors it's active state.
  4. env? table Custom environment to use for coroutine, defaults to _ENV.
  5. forceActive? boolean Whether or not this coroutine will always have user events.

Returns

  1. number PID of the coroutine. This shouldn't change.
killCoro(coro)Source

Kill a coroutine, and remove it from the coroutine table.

Parameters

  1. coro Coroutine to kill, accepts a number (index in table) or a string (name of coroutine).
runCoros()Source

Run the coroutines. This doesn't take any parameters nor does it return any.

stop()Source

Stop the coroutine manager, halting all threads after current loop. Note that this will not stop it immediately.

resume(pid, ...)Source

Resume a coroutine with a custom event, with error handling and such.

Parameters

  1. pid number Process ID of coroutine to resume.
  2. ... Event details to resume with.