spawn(func, arg1, arg2, ...)
Description
Calls a Lua function and executes it in a separate, parallel thread.
Available in: Controller, Processor.
Arguments
func | The name of the function to be called. | function |
---|---|---|
arg1, arg2, ... | The arguments of the function. | optional |
Example
-- play echos after releasing the note function echoNotes(event, echos) local duration = getBeatDuration() for i=1, echos do wait(duration*0.5) playNote(event.note+7*i, event.velocity*1/i, duration*0.25) end print("Spawn function of Note", event.note, "ended at", getTime()) end function onNote(event) postEvent(event) waitForRelease() spawn(echoNotes, event, 3) print("Note", event.note, "was released at", getTime()) end
See Also: runAsync, runSync, wait, waitBeat, waitForRelease
1 Comment
Sabine Pfeifer
proofread done