View Single Post
06-21-20, 06:16 AM   #1
Aur0r4
A Deviate Faerie Dragon
 
Aur0r4's Avatar
AddOn Compiler - Click to view compilations
Join Date: Feb 2010
Posts: 16
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)
return '|cff%02x%02x%02x%s|r %s%s%s|',r,g,b,Name(unit),Angle(AFK(unit) or DND(unit))
HP % (HPColor)
Code:
local s = Status(unit)
if s then
  return s
end
local cur,max = HP(unit),MaxHP(unit);
local hr,hg,hb=HPColor(cur,max);
return "|cff%02x%02x%02x%.0f|r" or "", hr,hg,hb,100*cur/max

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)
if s then
  return s
end

local cur,max = HP(unit),MaxHP(unit);
local hr,hg,hb=HPColor(cur,max);
local r,g,b = ClassColor(unit)

return '|cff%02x%02x%02x%s|r %s%s%s| |cff%02x%02x%02x%.0f|r',r,g,b,Name(unit),Angle(AFK(unit) or DND(unit)), hr,hg,hb,100*cur/max
__________________
Aur0r4
Yuluria


See Yulu UI in action: here

F.A.Q.
  Reply With Quote