JUCS - Journal of Universal Computer Science 10(7): 910-925, doi: 10.3217/jucs-010-07-0910
Coroutines in Lua
expand article infoAna Lúcia De Moura, Noemi Rodriguez§, Roberto Ierusalimschy|
‡ Catholic University of Rio de Janeiro, Rio de Janeiro, Brazil§ Pontifical Catholic University of Rio de Janeiro, Rio de Janeiro, Brazil| PUC-Rio, Rio de Janeiro, Brazil
Open Access
Abstract
After a period of oblivion, a renewal of interest in coroutines is being observed. However, most current implementations of coroutine mechanisms are restricted, and motivated by particular uses. The convenience of providing true coroutines as a general control abstraction is disregarded. This paper presents and discusses the coroutine facilities provided by the language Lua, a full implementation of the concept of asymmetric coroutines. It also shows that this powerful construct supports easy and succint implementations of useful control behaviors.
Keywords
coroutines, control structures, generators, Lua language