Call as
Platform.glyphs.socket(self, fn, index, position)
Record the dependency Platform.glyphs.socket, 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 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.
Arguments
| Name | Type | What it does |
|---|---|---|
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. |
Returns
| 1 | table | Slot record: slot plus active (and spellID), or slot plus reason when unavailable. |
|---|
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.
Secret values (Retail and Forever)
On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.
How the addon calls it
Platform.glyphs.GetGlyphSocketSnapshotlocal record=socket(self,fn,index,position)
Dependencies
integer→Platform.glyphs.integer
Source
Platform/glyphs.lua, line 71. Read only in game; Duplicate makes an editable copy.
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}