From 1f1deea662da4328bf588c0642c8a90c7b1f2144 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 24 Sep 2013 21:06:41 -0400 Subject: Rough draft of manual. --- doc/scripting/coroutine.texi | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 doc/scripting/coroutine.texi (limited to 'doc/scripting/coroutine.texi') 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 -- cgit v1.2.3