wowpedia
Main Menu


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

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