After a coroutine finishes, its status becomes complete rather than suspended.

Completion Status

completion_status.lua
local target = 
local step = 0
local status = "suspended"

while step < target do
  step = step + 1
  status = "yielded"
end

if step == target then
  status = "dead"
end

print("target=" .. target)
print("step=" .. step)
print("status=" .. status)
local target = 
local step = 0
local status = "suspended"

while step < target do
  step = step + 1
  status = "yielded"
end

if step == target then
  status = "dead"
end

print("target=" .. target)
print("step=" .. step)
print("status=" .. status)
local target = 
local step = 0
local status = "suspended"

while step < target do
  step = step + 1
  status = "yielded"
end

if step == target then
  status = "dead"
end

print("target=" .. target)
print("step=" .. step)
print("status=" .. status)
finished state Lua reports a completed coroutine as `dead`; this page models the final label without creating a thread object.