Reference › Function reference › Functions

Functions.presentation.compareString

public

Call as

Functions.presentation.compareString(operator, left, right, primary)

Record it as a dependency named Functions.presentation.compareString (accepting the completion does this), then call it by that name.

What it does

Format comparison wording with named Boolean alternatives when the operator has a negative form. The primary flag marks the positive form as the primary alternative. Positive operator labels use the captured operator map; negative labels and nullable dispatch retain their live addon APIs.

Arguments

NameTypeWhat it does
operatorstring | nilRM comparison operator identifier; missing labels use the operator placeholder.
leftstring | numberText or number shown before the comparison wording.
rightstring | numberText or number shown after the comparison wording.
primaryboolean | nilMark the positive wording as the primary named alternative.

Returns

1stringComparison text retaining named Boolean alternative markup.

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

  • Any Spell Charges (print)
    Functions.presentation.compareString(value.operator, string.format(L["number of charges on %s"], Functions.presentation.nullable(link, L["<spell>"])), Functions.presentation.nullable(value.value)))
  • Any Spell Cooldown (print)
    Functions.presentation.compareString(value.operator, string.format(L["cooldown on %s"],  Functions.presentation.nullable(link, L["<spell>"])),
  • Any Spell Recharge Time (print)
    Functions.presentation.compareString(value.operator, string.format(L["recharge time on %s"], Functions.presentation.nullable(link, L["<spell>"])),
  • Boss Mod Encounter Stage (print)
    return Functions.presentation.compareString(value.operator, L["the boss-mod encounter stage"], Functions.presentation.nullable(value.value))
  • Boss Mod Timer (print)
    return Functions.presentation.compareString(value.operator, string.format(L["the boss-mod timer for %s"], spell),
  • Cast Progress (print)
    return Functions.presentation.compareString(value.operator, string.format(L["%s cast progress"], Functions.presentation.nullable(addon.unitsPossessive[value.unit], L["<unit>"])), Functions.presentation.nullable(v) .. "%")
  • Cast Time Remaining (print)
    return Functions.presentation.compareString(value.operator,
  • Channel Progress (print)
    return Functions.presentation.compareString(value.operator, string.format(L["%s channel progress"], Functions.presentation.nullable(addon.unitsPossessive[value.unit], L["<unit>"])), Functions.presentation.nullable(v) .. "%")

and 43 more: Channel Time Remaining (print), Class In Group (print), Distance Count (print), Eclipse (print), Group Count (print), Health (print), Health Percentage (print), Item Cooldown (print), Mythic+ Keystone Level (print), Level (print), Loss Of Control Blocked (print), Loss Of Control Type (print), Mana (print), Mana Percentage (print), Raid Mark Count (print), Pet Spell Charges (print), Pet Spell Cooldown (print), Pet Spell Recharge Time (print), Points (print), Power (print), Power Percentage (print), Allies Within Range (print), Resistant (print), Runes (print), Rune Cooldown (print), Level (print), Spell Charges (print), Spell Cooldown (print), Spell Recharge Time (print), Stagger (print), Character Stat (print), Weapon Swing Time (print), Weapon Swing Time Remaining (print), Talent (print), Talent Tree Points (print), Threat Count (print), Time Since Combat Start (print), Totem Time Remaining (print), Specific Totem Time Remaining (print), Time Until Health (print), Time Until Health Percentage (print), Weapon Enchant Time Remaining (print), Weapon Enchant Stacks (print)

Dependencies

Source

Functions/presentation.lua, line 73. Read only in game; Duplicate makes an editable copy.

Functions.presentation.compareString(operator, left, right, primary)
    local positive=addon.nullable(operators[operator], L["<operator>"])
    local negative=(addon.negatedOperators or {})[operator]
    local predicate=negative and ('{{'..(primary and '!' or '')..positive..'|'..negative..'}}') or positive
    return left .. " " .. predicate .. " " .. right

Back to Function reference