pub fn new_thread(
state: &mut LuaState,
initial_body: Option<LuaValue>,
) -> Result<(), LuaError>Expand description
Allocate a fresh coroutine LuaState, register it under a new
ThreadId, and push the resulting LuaValue::Thread(value) onto
state’s stack.
If initial_body is Some(f), f is also pushed onto the new
thread’s stack so that coroutine.status reports "suspended"
rather than "dead". co_create uses this to stage the body function
without a full stack transfer between threads.