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
| Name | Type | What it does |
|---|---|---|
fn | function | nil | Native API function to call; any non-function yields missing-api. |
... | any | Arguments forwarded unchanged to fn. |
Returns
| 1 | any | First result of fn (possibly nil), or nil on failure. Further results are discarded. |
|---|---|---|
| 2 | string | nil | missing-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
Platform.actions.GetSpellRangeStatehasRange,why=call(nativeShape,id)Platform.actions.findSlotlocal slot,reason=call(FindSpellBookSlotBySpellID,id,pet)
Dependencies
platform(builtin:Platform/actions.lua:platform)
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