lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Define "pure"

In this context pure means that we don't call side-effecting functions (i.e we only call other pure functions) and upvalues are never modified by the body of the coroutine. 

My understanding of a freshly created coroutine is that it's a lua_State with the body function immediately pushed on the stack. 

(gross oversimplification) So we make one of these using a suspended coroutine's body function and then somehow copy data from the old coroutine so that  they're in the same state.

Most of the work here is in creating the clone of the child lua_State.