Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

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[]

Advertisement