February 2015
Beginner to intermediate
244 pages
4h 37m
English
This section covers an interesting parallelism mechanism in Lua called coroutines that will help us achieve collaborative multitasking.
Coroutines in Lua are a very interesting feature that allow developers to execute multiple tasks cooperatively. Each coroutine has its own execution stack, and they are used in the background by NSE to encapsulate the execution of its scripts. The main advantage of using coroutines is the ability to suspend and yield execution of tasks. It is important to understand the difference between coroutines in Lua and traditional threads in preemptive multitasking. Coroutines share context data and, therefore, must be used to reduce overhead when working with tasks that share a lot ...
Read now
Unlock full access