Reference › Function reference › Platform

Platform.role.roleValue

dependency

Call as

Platform.role.roleValue(self, value)

Record the dependency Platform.role.roleValue, 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

Validates a role returned by a native API. Returns the value when it is a readable nonempty string (such as TANK, HEALER or DAMAGER); otherwise nil with "restricted-value", "role-unavailable" (nil) or "invalid-api-result".

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (normally addon.Platform), used for its CanReadValue check.
valueanyRole value returned by the native API.

Returns

1string | nilThe role string, or nil when unavailable.
2string | nilReason when the role is nil.

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.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
canaccessvalueClassic EraTBC AnniversaryClassic progressionForeverRetail

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

Source

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

Platform.role.roleValue(self, value)
    if not self:CanReadValue(value) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(value) then return nil,'restricted-value' end
    if value==nil then return nil,'role-unavailable' end
    if type(value)~='string' or value=='' then return nil,'invalid-api-result' end
    return value

Back to Function reference