waitForAny 143
Pause the execution of the script until any of the given conditions are met.
Return value
| Return Type | Description |
|---|---|
| void | This function doesn't return anything |
Parameters
| Parameter | Type | Description |
|---|---|---|
| 1 | function | One or multiple functions to check condition for |
Examples
Example 35
-- get a soldier (uncomplete)
local soldierToKill1 = spawnSoldier(....)
local soldierToKill2 = spawnSoldier(....)
-- create a condition that waits for each them to die
local condition1 = function() return not soldierToKill1:isAlive() end
local condition2 = function() return not soldierToKill2:isAlive() end
-- wait for the condition to be true
waitUntil(condition1, condition2)
-- print result
print("One of the soldiers is is dead!")