type

From Garry's Mod
Jump to: navigation, search
 type( )

Contents

Description

Returns a string representing the name of the type of the passed object.

Arguments

any var

The object to get the type of.

Returns

string

The name of the object's type.

Examples

Example

Print the name of a few types.

print( type(2) )
print( type("hai") )
print( type({}) )

Output:

number
string
table

Examples

Example

Returns "no value" if called with 0 arguments/parameters.

print( type() )

Output:

no value

Examples

Example

A list of code showing how you can use the type function in replacement with any of the "is" functions. (example being istable, isentity, etc.)

print(type(LocalPlayer()))
print(type(Vector()))
print(type(Angle()))
print(type(Entity(num))) -- -> num is the EntIndex for the entity
print(type(vgui.Create("DFrame")))

Output:

Player
Vector
Angle
Entity
Panel
Personal tools
Navigation