Expand description
Coroutine library — port of lcorolib.c.
Provides the coroutine.* standard-library table: create, resume,
running, status, wrap, yield, isyieldable, and close.
§Phase A–D stub notice
Every function that requires actual coroutine execution (resume, yield,
cross-thread xmove, new_thread, close_thread) is unimplemented and
will panic at runtime. The argument-checking and result-packaging logic is
translated faithfully so that Phase E can drop in the real implementations
without restructuring. Phase E wires real stackful coroutines via
corosensei. See PORTING.md §2 #6.
Translated from: reference/lua-5.4.7/src/lcorolib.c (210 lines, 12 functions)
Target crate: lua-stdlib
Constants§
- CO_
FUNCS - Registration table for the
coroutinestandard library.
Functions§
- co_
close coroutine.close(co)— close a dead or suspended coroutine.- co_
create coroutine.create(f)— create a new coroutine that will run functionf.- co_
isyieldable coroutine.isyieldable([co])— test whether a coroutine (default: current) is in a yieldable state.- co_
resume coroutine.resume(co [, val1, ...])— attempt to resume coroutineco.- co_
running coroutine.running()— return the current coroutine plus a boolean.- co_
status coroutine.status(co)— return a string describingco’s current status.- co_wrap
coroutine.wrap(f)— create a coroutine and return a resuming function.- co_
yield coroutine.yield([...])— suspend the running coroutine.- open_
coroutine - Opens the
coroutinestandard library by pushing a new table containing allcoroutine.*functions.