local mystring = "Raid 1" local newstring, _ = string.gsub(mystring, "(.)", "%1\n")
- Registered User
Member for 13 years, 8 months, and 5 days
Last active Fri, Oct, 4 2013 14:30:03
- 0 Followers
- 6 Total Posts
- 0 Thanks
Dec 28, 2009The first bit:Posted in: Unit Frames
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.
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/
Aug 19, 2009_ForgeUser201348 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.Posted in: Unit Frames
I did this and could have both panels open at once, though it does cramp the screen a bit.
- To post a comment, please login or register a new account.