/ HALion Developer Resource / HALion Script / Reference /

wait

wait(ms)

Description

Function to suspend the execution of a callback for a specific time in milliseconds.

❕ If the wait function is used in the Controller thread, it operates at a lower rate and is therefore less accurate.

Available in: Controller, Processor.

Arguments

ArgumentDescriptionValue Type
msTime in ms.number

Example

-- Delay notes which have not been released for 1000 ms.

local initTime = getTime()
local releaseTime = {}
 
function onNote(event)
  local noteOnTime = getTime()
  wait(1000)
  if noteOnTime > (releaseTime[event.note] or initTime) then
    postEvent(event)
  end
end
 
function onRelease(event)
  releaseTime[event.note] = getTime()
  postEvent(event)
end

See also: waitBeat, waitForRelease, spawn, runAsync, runSync