Coroutine-safe xpcall and pcall versions


Coxpcall encapsulates the protected calls with a coroutine based loop, so errors can be dealed without the usual pcall/xpcall issues with coroutines.

Using Coxpcall usually consists in simply loading the module and then replacing Lua pcall and xpcall by copcall and coxpcall.

Coxpcall is free software and uses the same license as Lua 5.1.


Current version is 1.13. It was developed for Lua 5.1.


Coxpcall can be downloaded from its LuaForge page. You can also get Coxpcall using LuaRocks:

luarocks install coxpcall


Coxpcall 1.13 [19/May/2008]
  • Fixed bug [#5275], found by Gary NG
Coxpcall 1.12 [09/May/2008]
  • Added stack traces
Coxpcall 1.11 [22/Jan/2008]
  • Moving Coxpcall to a standalone project since its now being used by more than only Xavante
  • Refactoring and bug fixes by Thomas Harning Jr., Ignacio Burgueño and Fábio Mascarenhas
Coxpcall 1.0 [18/Feb/2005]
Coxpcall 1.0 until 1.11 was released as part of Xavante


Coxpcall offers two functions that reproduce the behaviour of pcall and xpcall:

coxpcall(f, err)
Offers the same functionality as Lua xpcall(f, err).
copcall(f, ...)
Offers the same functionality as Lua pcall(f, ...).


Coxpcall was designed and implemented by Roberto Ierusalimschy and André Carregal with the colaboration of Thomas Harning Jr., Ignacio Burgueño, Gary NG and Fábio Mascarenhas as part of the Kepler Project which holds its copyright.

Contact us

For more information please contact us. Comments are welcome!

You can also reach other Coxpcall developers and users on the Kepler Project mailing list.

Valid XHTML 1.0!

$Id: index.html,v 1.4 2008/05/19 20:32:33 carregal Exp $