Skip to main content

co_running

Function co_running 

Source
pub fn co_running(state: &mut LuaState) -> Result<usize, LuaError>
Expand description

coroutine.running() โ€” return the current coroutine plus a boolean.

push_thread pushes the current LuaState as a thread value and returns true iff it is the main thread.

The return arity is version-gated (pinned by running_in_*_arity_by_version in tests/coro_strengthen.rs). From 5.2 the result is (thread, ismain) where ismain is true for the main thread. Lua 5.1 has no ismain boolean: it returns nil in the main coroutine and only the running thread (one value) inside a coroutine (verified against lua5.1.5; see specs/followup/5.1-roster-syntax.md ยง1).