Quantcast
Combine two lua scripts - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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: 11
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

See Yulu UI v8 in action: here
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Combine two lua scripts

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off