Reference › Function reference › Conditions

Conditions.bossmod.idEditor

dependency

Call as

Conditions.bossmod.idEditor(parent, label, current, changed)

Record the dependency Conditions.bossmod.idEditor, 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

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.

Arguments

NameTypeWhat it does
parenttableCondition widget group the control is added to.
labelstringLabel shown above the edit box.
currentnumber | nilSaved ID to display; nil shows an empty box.
changedfunctionCalled with the accepted positive whole-number ID, or nil when the text is blank or invalid.

Returns

1RMConditionInputThe edit box, already added to parent.

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.

How the addon calls it

  • Boss Mod Encounter (widget)
    idEditor(parent, L["Encounter ID (blank for any)"], value.encounter, function(id) value.encounter = id; update() end)
  • Boss Mod Timer (widget)
    idEditor(parent, L["Boss ability spell ID"], value.spell, function(id)

Dependencies

Source

Conditions/bossmod.lua, line 70. Read only in game; Duplicate makes an editable copy.

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

Back to Function reference