diff options
Diffstat (limited to 'doc/scripting/coroutine.texi')
-rw-r--r-- | doc/scripting/coroutine.texi | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/scripting/coroutine.texi b/doc/scripting/coroutine.texi new file mode 100644 index 0000000..75723da --- /dev/null +++ b/doc/scripting/coroutine.texi @@ -0,0 +1,38 @@ +@node Coroutines +@section Coroutines + +Coroutines are the building block for cooperative multitasking. When +used with agendas, they are a powerful mechanism for writing game +scripts. + +@anchor{2d coroutine coroutine}@defun coroutine thunk +Calls a procedure that can yield a continuation. + +@end defun + +@anchor{2d coroutine colambda}@defspec colambda args body ... +Syntacic sugar for a lambda that is run as a coroutine. + +@end defspec + +@anchor{2d coroutine codefine}@defspec codefine (name ...) . body +Syntactic sugar for defining a procedure that is run as a coroutine. + +@end defspec + +@anchor{2d coroutine codefine*}@defspec codefine* (name ...) . body +Syntactic sugar for defining a procedure with optional and keyword +arguments that is run as a coroutine. + +@end defspec + +@anchor{2d coroutine wait}@defun wait [delay] +Yield coroutine and schdule the continuation to be run after DELAY +ticks. + +@end defun + +@anchor{2d coroutine yield}@defun yield callback +Yield continuation to a CALLBACK procedure. + +@end defun |