Chiamala come
Platform.glyphs.socket(self, fn, index, position)
Registra la dipendenza Platform.glyphs.socket, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.
Cosa fa
Reads one glyph socket by calling fn(index) in protected mode and always returns a slot record with slot=index. The record has active=false when the socket is locked or empty, active=true with spellID when a glyph is present, or a reason (api-error, restricted-value, glyph-socket-unavailable, invalid-api-result) with active left nil.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (normally addon.Platform), used for its CanReadValue check. |
fn | function | GetGlyphSocketInfo, called with index as its only argument. |
index | number | Glyph socket index. |
position | number | Position of the glyph spell ID in the fn result, as returned by layout. |
Valori restituiti
| 1 | table | Slot record: slot plus active (and spellID), or slot plus reason when unavailable. |
|---|
Edizioni
Le funzioni di supporto integrate sono registrate su ogni edizione. Ciò che cambia è l'API di gioco che leggono; dove ne manca una, la funzione di supporto ripiega su un'alternativa o restituisce nil con un motivo.
Non legge direttamente alcuna API di gioco.
Valori segreti (Retail e Forever)
Su Retail e Forever il gioco fornisce agli addon valori segreti. Questa funzione di supporto controlla ciò che legge (addon.Platform:CanReadValue) e restituisce nil con un motivo come restricted-value invece di un valore segreto che non può confrontare. Considera nil come non disponibile, non come false.
Come la chiama l'addon
Platform.glyphs.GetGlyphSocketSnapshotlocal record=socket(self,fn,index,position)
Dipendenze
integer→Platform.glyphs.integer
Sorgente
Platform/glyphs.lua, riga 71. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Platform.glyphs.socket(self, fn, index, position)
local ok,tuple=pcall(function() return {fn(index)} end)
if not ok then return {slot=index,reason='api-error'} end
local enabled,kind,spell=tuple[1],tuple[2],tuple[position]
if not self:CanReadValue(enabled) or not self:CanReadValue(kind) then return {slot=index,reason='restricted-value'} end
if enabled==nil and kind==nil then return {slot=index,reason='glyph-socket-unavailable'} end
if not integer(kind,1) or enabled~=nil and type(enabled)~='boolean' then return {slot=index,reason='invalid-api-result'} end
if not enabled then return {slot=index,active=false} end
if not self:CanReadValue(spell) then return {slot=index,reason='restricted-value'} end
if spell==nil then return {slot=index,active=false} end
if not integer(spell,1) then return {slot=index,reason='invalid-api-result'} end
return {slot=index,active=true,spellID=spell}