Garry's Mod Wiki

Revision Difference

Global.IsColor#529426

<function name="IsColor" parent="Global" type="libraryfunc"> <description> Returns whether the given object does or doesn't have a `metatable` of a color. <bug issue="2407">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.</bug> </description> <realm>Shared and Menu</realm> <args> <arg name="Object" type="any">The object to be tested</arg> </args> <rets> <ret name="" type="boolean">Whether the given object is a color or not</ret> </rets> </function> ⤶ <example>⤶ <description>How work 'isColor' function ?</description>⤶ <code>⤶ local color = Color(255, 255, 255)⤶ ⤶ print(IsColor(color) or "This variable is not a colour")⤶ </code>⤶ <output>⤶ ```⤶ true⤶ ```⤶ </output>⤶ </example>⤶