Combine two lua scripts
Hi guys,
Since I'm not good in Lua and my friends that are more into programming can't help me with that, this forum is my last hope. I want to create a Lua-Text in PitBull Unit Frames, so that it shows this: Name | HP % Name should be in classcolor and HP% in HPColor. So I have to separate scripts for that running: Name | (ClassColor) Code:
local r,g,b = ClassColor(unit) Code:
local s = Status(unit) I want to combine both scripts, so that I can display them in one lua-text. I need that, because otherwise I'm not able to center the text within the unitframe. Can you help me with that? Thanks! edit: We've tried that, but it isn't working: Code:
local s = Status(unit) |
I don't know PitBull so I'm not sure what Status() or Angle() is doing but my best guess is that it has more than 1 return and all but the first one are being cut off because it's no longer the last return in the format.
Without thinking too hard, maybe something like still treating the return as two strings: Lua Code:
|
|
Lua Code:
Someone here probably has a better solution. |
Thank you!
Sadly it is the same outcoming :( Name |CFF00FF00100 Quote:
Nevermind: My girlfriend fixed it :p Lua Code:
|
According to PitBull documentation, "LuaText" is simply fed into SetFormattedText and Angle returns three strings, which surrounds the input with "angle brackets" < >. If there's no input, in this case if the unit is not afk or dnd, it still returns three empty strings. Also, if you want to use the pipe character or the percent sign, you need to escape both.
Lua Code:
I left a space between the health and the percent sign. Edit: I didn't refresh the page before posting, looks like you got it working anyways :) |
Thanks Kanegesi, it's only half as long, nice. But unfortunately, it gives you an ERROR. :P
|
Thank you for trying my code out, even though you stated you had something working. Unfortunately, "it gives you an ERROR" is not helpful at all.
|
Both ClassColor() and Angle() are only giving their first return values since they are not at the end of the list. The rest are discarded.
Lua Code:
|
All times are GMT -6. The time now is 12:23 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI