Llamar como
Conditions.bossmod.idEditor(parent, label, current, changed)
Registra la dependencia Conditions.bossmod.idEditor y luego llámala con ese nombre. Una llamada con espacio de nombres no pasa self: usa una llamada con dos puntos o pasa tú mismo el objeto.
Qué hace
Builds a full-width edit box for an optional boss-mod ID (such as the encounter ID) and adds it to parent. On Enter it passes the typed number to changed only when validID accepts it, otherwise nil, and rewrites the box to the accepted ID or blank.
Argumentos
| Nombre | Tipo | Qué hace |
|---|---|---|
parent | table | Condition widget group the control is added to. |
label | string | Label shown above the edit box. |
current | number | nil | Saved ID to display; nil shows an empty box. |
changed | function | Called with the accepted positive whole-number ID, or nil when the text is blank or invalid. |
Retornos
| 1 | RMConditionInput | The edit box, already added to parent. |
|---|
Ediciones
Las funciones auxiliares integradas se registran en todas las ediciones. Lo que cambia es la API del juego que leen; donde falta alguna, la función auxiliar recurre a una alternativa o devuelve nil con un motivo.
No lee directamente ninguna API del juego.
Cómo la llama el addon
- Encuentro del mod de jefes (widget)
idEditor(parent, L["Encounter ID (blank for any)"], value.encounter, function(id) value.encounter = id; update() end) - Temporizador del mod de jefes (widget)
idEditor(parent, L["Boss ability spell ID"], value.spell, function(id)
Dependencias
validID→Conditions.bossmod.validID
Código fuente
Conditions/bossmod.lua, línea 70. Solo lectura en el juego; Duplicar crea una copia editable.
Conditions.bossmod.idEditor(parent, label, current, changed)
local edit = addon:CreateConditionEditBox()
edit:SetFullWidth(true)
edit:SetLabel(label)
edit:SetText(current and tostring(current) or "")
edit:SetCallback("OnEnterPressed", function(_, _, text)
local id = tonumber(text)
changed(validID(id) and id or nil)
edit:SetText(validID(id) and tostring(id) or "")
end)
parent:AddChild(edit)
return edit