Appel
Platform.roster_class.rosterUnit(unit)
Enregistrez la dépendance Platform.roster_class.rosterUnit, puis appelez-la sous ce nom. Un appel par espace de noms ne transmet pas self : utilisez un appel avec deux-points ou passez l'objet vous-même.
Ce qu'elle fait
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
| Nom | Type | Ce qu'elle fait |
|---|---|---|
unit | string | Unit token to test. |
Retours
| 1 | boolean | True for an accepted roster unit token. |
|---|
Éditions
Les fonctions utilitaires intégrées sont enregistrées sur toutes les éditions. Ce qui diffère, c'est l'API du jeu qu'elles lisent ; quand l'une manque, la fonction utilitaire se rabat sur une alternative ou renvoie nil avec une raison.
Elle ne lit directement aucune API du jeu.
Comment l'addon l'appelle
Platform.roster_class.GetRosterClassObservationif type(unit)~='string' or not rosterUnit(unit) then return nil,'invalid-roster-unit' end
Source
Platform/roster_class.lua, ligne 15. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.
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)