blob: bff115d46bdb14240ede0167d6f0cf0743625d5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#!/usr/bin/env nomsu -V2.4.4.3
#
This file defines the code that creates and manipulates coroutines
use "core/metaprogramming.nom"
compile [coroutine %body, generator %body] to (..)
Lua value "(function()\n \(%body as lua statements)\nend)"
compile [->] to (Lua value "coroutine.yield(true)")
compile [-> %] to (Lua value "coroutine.yield(true, \(% as lua expr))")
compile [for % in coroutine %co %body] to (..)
Lua ".."
for junk,\(% as lua expr) in coroutine.wrap(\(%co as lua expr)) do
\(%body as lua statements)
end
|