waitForAny 3

Pause the execution of the script until any of the given conditions are met.


Return value

Return TypeDescription
voidThis function doesn't return anything

Parameters

ParameterTypeDescription
1functionOne or multiple functions to check condition for

Examples

-- 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!")

Back to Scripting API