wowpedia
Main Menu


Calls a function for each pair within a table without propagating taint to the caller.

secureexecuterange(tbl, func, ...)

Arguments

tbl
table - The table to be traversed.
func
function - The function to be called for each pair.
...
Additional arguments to supply to the invoked function.

Details

Example Implementation

The implementation of this function would, if not provided natively by the client, be effectively similar to the snippet below. This example aims to demonstrate how error handling and taint is processed with regards to individual pairs within the table.

local function secureexecutenext(tbl, prev, func, ...)
    local key, value = next(tbl, prev)

    if key ~= nil then
        pcall(func, key, value, ...)  -- Errors are silently discarded!
    end

    return key
end

function secureexecuterange(tbl, func, ...)
    local key = nil

    repeat
        key = securecallfunction(secureexecutenext, tbl, key, func, ...)
    until key == nil
end

Patch changes

Shadowlands Patch 9.1.5 (2021-11-02): Added.