Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Creates a function container that invokes a cancellable callback function.
container = C_FunctionContainers.CreateCallback(func)
Arguments[]
- func
- function - A Lua function to be called.
Returns[]
- container
- FunctionContainer - A container object bound to the supplied function.
Details[]
- The supplied callback must be a Lua function. The API will reject C functions and any non-function values.
Example[]
The following snippet creates a function container and schedules it to be executed every second, cancelling itself after five calls.
local container = C_FunctionContainers.CreateCallback(function()
container.timesCalled = container.timesCalled + 1
if container.timesCalled == 5 then
container:Cancel()
end
print("Called!")
end)
container.timesCalled = 0
C_Timer.NewTicker(1, container)
Patch changes[]
- Patch 10.0.0 (2022-10-25): Added.