Reference › Function reference › Platform

Platform.loss_of_control.GetLossOfControlCount

public

Call as

addon.Platform:GetLossOfControlCount()

Available directly through addon; no dependency is needed.

What it does

Read the documented active loss-of-control count with a protected zero-argument dot call. Require a readable finite nonnegative integer. Zero is a complete empty scan and does not require a row API. RM limits a scan to 256 rows and returns unavailable beyond that resource budget; this is not a declared native maximum. Required missing, failed, restricted or malformed observations remain unavailable.

Arguments

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

Returns

1number | nilKnown active count from zero through the RM scan budget, or nil when unavailable.
2string | nilCombat-policy, capability, observation or scan-budget reason for a nil count.

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_LossOfControlClassic 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.

Example

local count = addon.Platform:GetLossOfControlCount()
if count == nil then return nil end
return count > 0

Source

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

Platform.loss_of_control.GetLossOfControlCount(self)
    local policy=self:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    local namespace=C_LossOfControl
    if not self:CanReadValue(namespace) then return nil,'restricted-value' end
    if type(namespace)~='table' then return nil,'missing-api' end
    local methodOk,method=pcall(function() return namespace.GetActiveLossOfControlDataCount end)
    if not methodOk then return nil,'api-error' end
    if not self:CanReadValue(method) then return nil,'restricted-value' end
    if type(method)~='function' then return nil,'missing-api' end
    local ok,count=pcall(method)
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(count) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(count) then return nil,'restricted-value' end
    if count==nil then return nil,'loss-of-control-count-unavailable' end
    if type(count)~='number' or count~=count or count==math.huge or count==-math.huge or count<0 or count%1~=0 then return nil,'invalid-api-result' end
    if count>256 then return nil,'loss-of-control-budget-exceeded' end
    return count

Back to Function reference