Thread:wait_for

Blocks this thread until its parent Script receives a specific signal.

Usage

thread:wait_for(signal)

Arguments

Name Type Description
signals string Signal to wait on.

Returns

Name Type Description
... any Additional arguments to the Script:signal call which unblocked this thread.

Examples

local script = crystal.Script:new();

script:run_thread(function(self)
  while true do
    local name = self:wait_for("greet");
    print("Hello " .. name);
  end
end);

script:signal("Alvina"); -- Prints "Hello Alvina"
script:signal("Tarkus"); -- Prints "Hello Tarkus"

This site uses Just the Docs, a documentation theme for Jekyll.