Garry's Mod Wiki

IsColor

IsColor

  boolean IsColor( any Object )

Description

Returns whether the given object does or doesn't have a metatable of a color.

Engine functions (i.e. those not written in plain Lua) that return color objects do not currently set the color metatable and this function will return false if you use it on them.

Issue Tracker: 2407

Arguments

1 any Object
The object to be tested

Returns

1 boolean
Whether the given object is a color or not

Example

How work 'isColor' function ?

local color = Color(255, 255, 255) print(IsColor(color) or "This variable is not a colour")
Output:
true

Special Pages


Wikis

?

Render Time: 58ms

DB GetPage 22
Generate Html 3
SaveChanges (1) 24
Render Body 0
Render Sidebar 6