gsub'ing |t and stuff
Okay so i added raid icons to the tooltip text. Now i may have gone about this all wrong but it works, and fairly well. I had to do a lot of extra gsubs because when you gsub just lastricon it leaves a big blank space... if you gsub |t it then prints the file path to the text. Is there a way to shorten up the gsubing that i did? why do some characters not gsub without another? like why in order to gsub a \ you have to do \\ hmm? this is what my code looks like curious what input everyone has.
It adds raid icons to the tooltip and updates when you add remove them, its hooked to the OnUpdate of the GameToolTip. This is especially nice because i use mouseover raid target icon setting macros. Code:
local lastricon = 1 |
Without knowing what you're trying to extract, and not wanting to reverse-engineer it from the gsub() mess, the only thing I can offer is a simplification of your if-nesting mess:
Code:
local lastricon = 1 |
if your gsub above removes a texture... like
|TTexturePath:otherjunk:morejunk|t is what your trying to remove, just do a text = text:gsub("\124T.*\124t", "") that removes the |T and |t and everything in between |
Quote:
Thats exactly what its doing, removing the icon texture and all the garble in between. Thanks. Torhal - I love how you refer to it all as a mess :) The reason you do the gametooltip:show more then once is to make it update the gametooltip's size according to if the icon is shown or not, and since you can keep the cursor over a target and add/remove raid icons you need the size to update without cursoring off of the target. Best way i found to do that was to just make it show tooltip again. Another way although i could not get it to work is to get it the gametooltip onupdate script again but i tried get script and just running bliz's function and it did not work like one would think. |
Quote:
text = text:gsub("\124T.-\124t", "") instead to capture the smallest possible amount of text between |T and |t. This is because .* captures the longest possible amount of text and if the text contains 2 texture links, you will get rid of all the text between the 2 textures. |
Quote:
|
Yes, that's exactly what I am saying.
|
Quote:
|
i thought .+ meant it was the longest possible string
edit:: oh .+ is 1 or more .* is 0 or more, but the longest .- is 0 or more, but the shortest. |
All times are GMT -6. The time now is 11:54 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI