Reference › Function reference › Platform

Platform.runes.validIndex

dependency

Call as

Platform.runes.validIndex(self, index)

Record the dependency Platform.runes.validIndex, 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 rune slot index. Returns true for a readable integer from 1 through 6; otherwise nil with "restricted-value" or "invalid-rune-index".

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (normally addon.Platform), used for its CanReadValue check.
indexanyRune slot index to validate.

Returns

1boolean | nilTrue when index is a valid rune slot; nil otherwise.
2string | nilReason when invalid.

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/runes.lua, line 24. Read only in game; Duplicate makes an editable copy.

Platform.runes.validIndex(self, index)
    if not self:CanReadValue(index) then return nil,'restricted-value' end
    if not finite(index) or index%1~=0 or index<1 or index>6 then return nil,'invalid-rune-index' end
    return true

Back to Function reference