A Quick Question, Please

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Post Reply
Message
Author
The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

A Quick Question, Please

#1 Post by The Artful Dodger »

Hello:

Is there a way to substitute a color name, (like "green" or "blue"), or a hex value (like #FF8000 or #DDA0DD) with a variable name? For instance:

Code: Select all

ARB_35_HAC_VAC   = "font: Arimo-Bold.ttf;  size: 35px; color: MySpecialGreen; halign: center; valign: center; weight: bold;"
For that matter, the same would go for the size:

Code: Select all

ARB_35_HAC_VAC   = "font: Arimo-Bold.ttf;  size: MyTextSizepx; color: #008000; halign: center; valign: center; weight: bold;"
This would allow me to change these parameters much more easily.

Thanks in advance.

Sparky

User avatar
Ralph
Posts: 7918
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: A Quick Question, Please

#2 Post by Ralph »

Yes you can.

Code: Select all

perenmoes = "font:roboto_bold.ttf;"
appelmoes = "size:60;"
mytext1 = txt_add("hello world", perenmoes .. appelmoes .. "color: red; halign:left;", 0, 0, 200, 200)

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: A Quick Question, Please

#3 Post by The Artful Dodger »

Hi, Ralph:

WOW - it would probably have been well into the next century before I would have figured that one out! Thanks!!

Sparky

User avatar
Ralph
Posts: 7918
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: A Quick Question, Please

#4 Post by Ralph »

There's some more information here: https://www.lua.org/pil/3.4.html

User avatar
jph
Posts: 2853
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: A Quick Question, Please

#5 Post by jph »

You can use the standard colour code hash as well ......

Code: Select all

perenmoes = "font:roboto_bold.ttf;"
appelmoes = "size:60;"
maxverstappen = "color:#FE6D26;"
 mytext1 = txt_add("hello world", perenmoes .. appelmoes .. maxverstappen.. "halign:left;", 0, 0, 250, 200)
Joe. CISSP, MSc.

User avatar
jph
Posts: 2853
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: A Quick Question, Please

#6 Post by jph »

Joe. CISSP, MSc.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: A Quick Question, Please

#7 Post by The Artful Dodger »

Hi, Guys:

It isn't the language I don't understand; I know concatenation very well. It's just that it never occurred to me to use it. Plus, FYI, I have a copy of the fourth edition of that book. But, if I didn't think of concatenation in the first place, I never would have found it. As soon as I saw the "..", the light bulb clicked on!

Thanks to both of you.

Sparky

User avatar
Ralph
Posts: 7918
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: A Quick Question, Please

#8 Post by Ralph »

It is indeed difficult to get this from a book. You would at least have to know the term 'concatenate'.

User avatar
jph
Posts: 2853
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: A Quick Question, Please

#9 Post by jph »

Ralph wrote: Mon Oct 03, 2022 5:17 pm It is indeed difficult to get this from a book. You would at least have to know the term 'concatenate'.
It makes you go blind...... ;)
Joe. CISSP, MSc.

Post Reply