Reference › Function reference › Platform

Platform.mobinfo2.hitCount

dependency

Call as

Platform.mobinfo2.hitCount(self, resists, school)

Record the dependency Platform.mobinfo2.hitCount, 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

Reads the hit count for a spell school from a MobInfo2 resists table (the field named school.."Hits"). A missing (nil or false) count defaults to 1; otherwise it returns a readable finite number, or nil with a reason from readField or finite (restricted-value, invalid-mobinfo2-data, mobinfo2-data-error, invalid-mobinfo2-number).

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (normally addon.Platform), used for its CanReadValue check.
resiststableThe resists table from a MobInfo2 mob record.
schoolstringSchool key used in the resists table; the field read is school.."Hits".

Returns

1number | nilRecorded hit count, 1 when none is recorded, or nil when unavailable.
2string | nilReason when the count 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.

It reads no game API directly.

How the addon calls it

Dependencies

Source

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

Platform.mobinfo2.hitCount(self, resists, school)
    local hits,reason=readField(self,resists,school..'Hits')
    if reason then return nil,reason end
    if hits==nil or hits==false then return 1 end
    local valid,why=finite(self,hits)
    if not valid then return nil,why end
    return hits

Back to Function reference