Call as
Platform.mobinfo2.finite(self, value)
Record the dependency Platform.mobinfo2.finite, 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
Checks that a value is a readable finite number. Returns true, or false with "restricted-value" for a secret value or "invalid-mobinfo2-number" for a non-number, NaN or infinity.
Arguments
| Name | Type | What it does |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (normally addon.Platform), used for its CanReadValue check. |
value | any | Value to test, such as a unit level or a MobInfo2 count. |
Returns
| 1 | boolean | True when value is a readable finite number. |
|---|---|---|
| 2 | string | nil | Reason when the result is false. |
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.mobinfo2.GetMobInfo2Observationlocal valid,why=finite(self,level)Platform.mobinfo2.hitCountlocal valid,why=finite(self,hits)
Source
Platform/mobinfo2.lua, line 17. Read only in game; Duplicate makes an editable copy.
Platform.mobinfo2.finite(self, value)
if not self:CanReadValue(value) then return false,'restricted-value' end
if type(value)~='number' or value~=value or value>=math.huge or value<=-math.huge then return false,'invalid-mobinfo2-number' end
return true