Call as
Platform.roster_class.rosterUnit(unit)
Record the dependency Platform.roster_class.rosterUnit, 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
Returns true when unit is exactly player, party1 through party4, or raid1 through raid40 (no leading zeros), and false for any other string. unit must be a string; callers check its type first.
Arguments
| Name | Type | What it does |
|---|---|---|
unit | string | Unit token to test. |
Returns
| 1 | boolean | True for an accepted roster unit token. |
|---|
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
Platform.roster_class.GetRosterClassObservationif type(unit)~='string' or not rosterUnit(unit) then return nil,'invalid-roster-unit' end
Source
Platform/roster_class.lua, line 15. Read only in game; Duplicate makes an editable copy.
Platform.roster_class.rosterUnit(unit)
if unit=='player' or unit:match('^party[1-4]$') then return true end
local slot=unit:match('^raid(%d+)$');slot=slot and tonumber(slot)
return slot~=nil and slot>=1 and slot<=40 and unit=='raid'..tostring(slot)