Talk:Color

From GMod Wiki

Jump to: navigation, search

Straight out of /lua/includes/util.lua Where color table creation occures

/*---------------------------------------------------------

   To easily create a colour table

*/

function Color( r, g, b, a )

a = a or 255 return { r = math.min( tonumber(r), 255 ), g = math.min( tonumber(g), 255 ), b = math.min( tonumber(b), 255 ), a = math.min( tonumber(a), 255 ) }

end


// Some nice globals so we don't keep creating objects for no reason

vector_origin = Vector( 0, 0, 0 ) vector_up = Vector( 0, 0, 1 ) angle_zero = Angle( 0, 0, 0 )

color_white = Color( 255, 255, 255, 255 ) color_black = Color( 0, 0, 0, 255 ) color_transparent = Color( 255, 255, 255, 0 )

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox