5. system

This section documents changes to system functions.

5.1. system.coroutine

5.1.1. system.coroutine.yield

function(
type : types.yield_type,
extra : variable
) : variable

Lua functions can yield at any point. The parameters and return types depend on why we want to yield.

A callback that is yielding allows other Lua code to run.

• WAIT_MS: one extra parameter; the execution will pause for that many miliseconds; yield returns nothing;

• FILE_READABLE: an opened file from a call to the OS library; will return when the file is readable; returns nothing;

• RUN_COMMAND: a command to be run by "sh -c"; will return when the command terminates; returns the return code of the execution.

type
types.yield_type

The type of yield.

extra
variable

An extra parameter: integer for "WAIT_MS", open file for "FILE_READABLE", string for "RUN_COMMAND".

return
variable

Nothing for "WAIT_MS" and "FILE_READABLE"; the returned code of the command for "RUN_COMMAND".