Reference › Function reference › Platform

Platform.actions.call

dependency

Call as

Platform.actions.call(fn, ...)

Record the dependency Platform.actions.call, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.

What it does

Calls a native API function in protected mode and returns its first result only when Rotation Master can read it. Returns nil with "missing-api" when fn is not a function, "api-error" when the call raises an error, or "restricted-value" when the result is a secret value (Retail and Forever); a successful nil result returns nil with no reason.

Arguments

NameTypeWhat it does
fnfunction | nilNative API function to call; any non-function yields missing-api.
...anyArguments forwarded unchanged to fn.

Returns

1anyFirst result of fn (possibly nil), or nil on failure. Further results are discarded.
2string | nilmissing-api, api-error or restricted-value on failure; nil on success.

Editions

Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.

It reads no game API directly.

Secret values (Retail and Forever)

On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.

How the addon calls it

Dependencies

Source

Platform/actions.lua, line 44. Read only in game; Duplicate makes an editable copy.

Platform.actions.call(fn, ...)
    if type(fn)~="function" then return nil,"missing-api" end
    local ok,value=pcall(fn,...)
    if not ok then return nil,"api-error" end
    if not platform:CanReadValue(value) then return nil,"restricted-value" end
    return value

Back to Function reference