STUF Lua editor
Hi all,
i'm trying to color a string using the class color in STUF, the problem is that i don't know how to do that... I tryied usin the table RAID_CLASS_COLORS but i must be missing something: local DB = {} for class, color in pairs(RAID_CLASS_COLORS) do DB.[class] = { color.r, color.g, color.b } end This code seems to be wrong or i can't access the table RAID_CLASS_COLORS but i don't get any error in that way however it seems that the structure DB in empty.... There another way to do that? Maybe using the 'cache' parameter? But using cache i only know how to get info like name, level ecc (info that anyway i can get using standard API), any thoughts? Thank you |
Code:
DB.[class] = { color.r, color.g, color.b } Otherwise I don't have any idea of STUF. |
Quote:
as soon as i get home i'll check in game what happens. thanks for the help |
I don't know,
for example this simple code here: Code:
function(unit, cache) Regards |
Because you put the class in { } brackets, there's a sub-table created for the class-string.
So, just write DB[class] = class to correct it. But I'm wondering what you're trying to achieve, because you basically get "ROGUE" back, if you're accessing the table with "ROGUE"? Normally class colors are stored in RAID_CLASS_COLORS and you just can access them via RAID_CLASS_COLORS["ROGUE"]. It returns a table holding the r,g,b, a-values for the color. And then you'd have to return it in the correct format (and there's the problem that I don't know, how STUF wants the data back). So basically, what string should the function return? Just the name, a classcolored name or just the class-color-values? That's not really clear for me ;) |
Actually i want a class-colored text and i need the rgb code for that but i can't get it and unpack in three local variables, i'll give it a try after dinner ;)
|
Is this something that you can't do with STUF's tag system?
|
Ok, for future reference i've done this ugly code here (:D):
Code:
function(unit, cache) Regards |
I'm still not sure why you didn't just use the regular (original) text patterns/tags to do this. :p I haven't been playing wow, so I don't recall exactly (there's a help window in-game), but it would just be level:class or somesuch.
|
Quote:
[classcolor=level] ? or is that dogtags |
Quote:
You're creating a DB table, and then one extra table for every class, every time this function is called (yes they will be collected but why waste the cycles in the first place? Why can't you do: Code:
for class, color in pairs(RAID_CLASS_COLORS) do Code:
function (unit, cache) |
Quote:
|
Quote:
Regards |
Stuf has tons of options and is extremely configurable and easy to get lost in... from what I've read here, everything you want to do can be done with Stuf's "dogtags."
Sample text coding for hp [difficulty:curhp] [hpthreshold:(][hpthreshold:perchp][hpthreshold:%][hpthreshold:)] If you guys are exploring LUA, then definitely cool discussion, but if you simply want to make Stuf look nice, use the in game editor, or just pull my Stuf and StufRaid layouts from my UI.. (completely color coded, with a cowtip feel regarding info). |
All times are GMT -6. The time now is 04:38 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI