• 0

    posted a message on LuaTexts Official Thread
    I'm no Lua expert, but try this on for size:

    local mystring = "Raid 1"
    
    local newstring, _ = string.gsub(mystring, "(.)", "%1\n")
    Posted in: Unit Frames
  • 0

    posted a message on PitBull 4.0
    The first bit:
    local dr, dg, db = DifficultyColor(unit)

    compares the unit's level to yours, and returns 3 values which give you an RGB color based on your level difference.

    For the next bit, you need to know that LuaTexts texts' return values are run through str.format, so the first value you give it is a format string which the rest of the values you pass are plugged into.

    |cff%02x%02x%02x%s%s|r %s

    This is the format string. It states that you're going to pass it 3 numbers (the %02x) which will be converted to 0 padded hex numbers. This will give you |cff...|r, which is how you specify which color you want your text to be. The two "%s" fields between the color and |r are strings which will be colored according to the color code.

    Next up comes the other return values, which get plugged into the format string in order.

    dr, dg, db get plugged into the %02x slots, so that makes the next two string values colored by the return from DifficultyColor(unit).

    Next we have Level(unit), which is self explanatory, and
    Classification(unit) and '+' or ''


    Classification(unit) returns Rare, Rare-Elite, Elite, Boss, etc. The way this bit is interpreted is "if Classification returns a non-false value, put a '+' in that slot, otherwise an empty string." The upshot is, if Classification gives you something other than an empty string, a '+' gets put next to the level.

    Lastly, we have
    SmartRace(unit) or ''

    This is similar to Classification(unit) in that if SmartRace returns a non-false value, it will use that, otherwise, fill it in with the empty string. SmartRace returns player races and NPC creature types or an empty string.

    So, if you only wanted to show level, you can remove the format fields that you don't want, and the return values that go with them. Always make sure you have something to go in every field and a field for every return value, or LuaTexts will yell at you because you made str.format sad.

    Let me know if I can clarify anything for you, I know it's a lot to digest.

    Documentation for helpful LuaTexts functions can be found here: http://www.wowace.com/addons/pitbull4/pages/lua-texts/
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    then I would use something like this

    local name, realm = UnitName(unit)
    return "%s-%s", name, realm
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    If I'm not mistaken, UnitName returns name, realm.
    Posted in: Unit Frames
  • 0

    posted a message on Pitbull 4.0: over-writes PB3, or fully distinct addon?
    They don't use the same control panel, but they have the same slash commands. You can edit Pitbull3's slash command in the main .lua file.

    I did this and could have both panels open at once, though it does cramp the screen a bit.
    Posted in: Unit Frames
  • 0

    posted a message on PitBull 4.0
    Glad to hear it. Hopefully they're be more forthcoming with a more general response sometime soon™.
    Posted in: Unit Frames
  • To post a comment, please or register a new account.