Reference › Function reference › Platform

Platform.range.GetNameplateMaxDistance

public

Call as

addon.Platform:GetNameplateMaxDistance()

Available directly through addon; no dependency is needed.

What it does

Read the current positive nameplate visibility distance using the supported CVar API. This limits a Distance Count query; it does not prove that all nearby units have been observed. Missing, malformed, restricted or failed observations return nil with a reason.

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (implicit with colon calls).

Returns

1number | nilCurrent positive visibility distance in yards; nil when unavailable.
2string | nilAvailability reason for a nil result.

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
C_CVar.GetCVarClassic EraTBC AnniversaryClassic progressionForeverRetail
GetCVarClassic 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

  • Distance Count (widget)
    local maximum=addon.Platform:GetNameplateMaxDistance()

Source

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

Platform.range.GetNameplateMaxDistance(self)
    local query=C_CVar and C_CVar.GetCVar or GetCVar
    if type(query)~='function' then return nil,'missing-api' end
    local ok,value=pcall(query,'nameplateMaxDistance')
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(value) then return nil,'restricted-value' end
    if type(value)~='string' and type(value)~='number' then return nil,'nameplate-distance-unavailable' end
    local maximum=tonumber(value)
    if not maximum or maximum~=maximum or maximum<=0 or maximum==math.huge then return nil,'nameplate-distance-unavailable' end
    return maximum

Back to Function reference