A coroutine can pause work and later continue from the suspended state.

Suspended State

suspended_state.lua
local requested = 
local state = "suspended"

if requested == "resume" then
  state = "running"
elseif requested == "pause" then
  state = "suspended"
end

print("requested=" .. requested)
print("state=" .. state)
local requested = 
local state = "suspended"

if requested == "resume" then
  state = "running"
elseif requested == "pause" then
  state = "suspended"
end

print("requested=" .. requested)
print("state=" .. state)
local requested = 
local state = "suspended"

if requested == "resume" then
  state = "running"
elseif requested == "pause" then
  state = "suspended"
end

print("requested=" .. requested)
print("state=" .. state)
lifecycle state This example models coroutine lifecycle labels without creating real coroutine objects.