Chame como
Conditions.bossmod.idEditor(parent, label, current, changed)
Registre a dependência Conditions.bossmod.idEditor e depois chame-a por esse nome. Uma chamada com namespace não passa self: use uma chamada com dois-pontos ou passe o objeto você mesmo.
O que faz
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
| Nome | Tipo | O que faz |
|---|---|---|
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. |
|---|
Edições
As funções auxiliares integradas são registradas em todas as edições. O que muda é a API do jogo que elas leem; quando uma está ausente, a função auxiliar recorre a uma alternativa ou retorna nil com um motivo.
Não lê nenhuma API do jogo diretamente.
Como o addon a chama
- Encontro do mod de chefe (widget)
idEditor(parent, L["Encounter ID (blank for any)"], value.encounter, function(id) value.encounter = id; update() end) - Temporizador do mod de chefe (widget)
idEditor(parent, L["Boss ability spell ID"], value.spell, function(id)
Dependências
validID→Conditions.bossmod.validID
Código-fonte
Conditions/bossmod.lua, linha 70. Somente leitura no jogo; Duplicar cria uma cópia editável.
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