According to the manual of version 5.3, a value of type thread represents independent threads of execution:
The type thread represents independent threads of execution and it is used to implement coroutines (see §2.6). Moon threads are not related to operating-system threads.
Does this mean that every time the body / scope of a function runs a new thread is created? Or does it happen with every kind of scope? For example:
-- Cria um thread (principal)
(function()
-- Cria um thread
for i = 1, 2 do
-- Cria outro thread
end
end)();
Or with functions only:
-- Cria um thread (principal)
(function()
-- Cria um thread
for i = 1, 2 do
end
end)();