Script:signal
Stops all threads in this script that were scheduled to stop upon this signal, in any order. Afterwards, runs all threads that were waiting for this same signal, in any order.
Usage
script:signal(signal_name, ...)
Arguments
| Name | Type | Description |
|---|---|---|
signal_name | string | Signal to emit. |
... | any | Values that will be received by threads waiting for the signal. |
Examples
local script = crystal.Script:new();
script:run_thread(function(self)
local item, amount = self:wait_for("crafting_complete");
print(item);
print(amount);
end);
script:signal("crafting_complete", "fishing rod", 5); -- prints "fishing rod" and "5"