Page 1 of 1

gl.Text and colors.

Posted: 31 Dec 2010, 09:36
by smoth
I cannot fathom it, in my infoboxoveride code:
http://pastebin.com/YTbgbQ6a
I can specify colors just fine,

however, add:
http://pastebin.com/Ee8atKQC

Which takes a defined color and builds it into a \#\#\#\# type string and I then insert it via:

Code: Select all

colors = VFS.Include("gamedata/colors.lua")

local ExoColor	= tostring(colors["exoColor"].argb)
local RefColor	= tostring(colors["refColor"].argb)
local MatColor	= tostring(colors["matColor"].argb)
it will print the \#\#\#\# instead of coloring my strings. REALLY QUEER. So why is it doing this, do you guys know?

Re: gl.Text and colors.

Posted: 31 Dec 2010, 10:13
by smoth
so kept getting pissed about this thing and then took a break only to think about how it converts theses \255 etc to characters then I thought about a joke I did to make my code unreadable in my intermediate comp sci class...

using character vars then suddenly I knew what I had to do.
changing my values to a string as though they were ascii chars.
>:3

Code: Select all

for name,vals in pairs(colors) do
	colorSets[name]	= {}
	colorSets[name].argb = string.char(math.floor(vals[4]*255),math.floor(vals[1]*255),
										math.floor(vals[2]*255),math.floor(vals[3]*255))
	colorSets[name].rgba = colors[name]
end