lua-users home
lua-l archive

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


> Right now, I'm blindly monkeying what "coxpcall" does [1], even though 
> I'm not quite understanding what it does in the first place and why :(

It allows you to execute a protected call to functions that yield from within. So if you have function f that uses a coroutine or is used by one, you can call

copcall(f)

and if f yields or calls someone that yields there is no problem.

The usual "pattern of use" is:

----------------
require"coxpcall"

pcall = copcall
xpcall = coxpcall

-- from here you can use pcall and xpcall at will
...
----------------

Andre