Aufruf als
Platform.glyphs.socket(self, fn, index, position)
Erfassen Sie die Abhängigkeit Platform.glyphs.socket und rufen Sie sie dann unter diesem Namen auf. Ein Aufruf über den Namensraum übergibt kein self: Verwenden Sie einen Doppelpunkt-Aufruf oder übergeben Sie das Objekt selbst.
Was sie bewirkt
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.
Argumente
| Name | Typ | Was sie bewirkt |
|---|---|---|
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. |
Rückgabewerte
| 1 | table | Slot record: slot plus active (and spellID), or slot plus reason when unavailable. |
|---|
Editionen
Integrierte Hilfsfunktionen werden auf jeder Edition registriert. Unterschiedlich ist die Spiel-API, die sie lesen; fehlt eine, weicht die Hilfsfunktion aus oder gibt nil mit einem Grund zurück.
Sie liest keine Spiel-API direkt.
Geheime Werte (Retail und Forever)
Auf Retail und Forever übergibt das Spiel Addons geheime Werte. Diese Hilfsfunktion prüft, was sie liest (addon.Platform:CanReadValue), und gibt statt eines geheimen Werts, den sie nicht vergleichen kann, nil mit einem Grund wie restricted-value zurück. Behandeln Sie nil als nicht verfügbar, nicht als false.
Wie das Addon sie aufruft
Platform.glyphs.GetGlyphSocketSnapshotlocal record=socket(self,fn,index,position)
Abhängigkeiten
integer→Platform.glyphs.integer
Quelle
Platform/glyphs.lua, Zeile 71. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.
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}