Entity.GetColor

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:GetColor( )
Description:
Returns the color the entity is set to.
Returns: Integer red, Integer green, Integer blue, Integer alpha or Color color β
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.GetColor]Entity.GetColor [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis code will get the color of a new entity and output it.
Used onNewerShared.png
Code
 
local ent = ents.Create("prop_physics");
ent:SetModel("model path");
ent:Spawn();
local r,g,b,a = ent:GetColor();
Msg("Color: (" .. r .. ", " .. g .. ", " .. b .. ", " .. a .. ")");
 
OutputColor: (255, 255, 255, 255)


DescriptionThis code will get the color of an entity and save it to a table.
Used onNewerShared.png
Code
 
local ent = ents.Create( "prop_physics" )
ent:SetModel( "model path" )
ent:Spawn( )
local Tbl = { ent:GetColor( ) }
Msg( "Color: (" .. Tbl[1] .. ", " .. Tbl[2] .. ", " .. Tbl[3] .. ", " .. Tbl[4] .. ")" )
 
OutputColor: (255, 255, 255, 255)


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox