Garry's Mod Wiki

Entity:GetVar

  any Entity:GetVar( any key, any default = nil )

Description

Retrieves a value from entity's Entity:GetTable. Set by Entity:SetVar.

Arguments

1 any key
Key of the value to retrieve
2 any default = nil
A default value to fallback to if we couldn't retrieve the value from entity

Returns

1 any
Retrieved value

Example

The 2 lines of code are functionally identical.

print( Entity( 1 ):GetVar( "Test" ) ) print( Entity( 1 ).Test )