Entity.GetVar

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:GetVar( Var index, Var default )
Description:
Returns Entity:GetTable()[index] (or default if Entity:GetTable()[index] is nil)
Returns: Var
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.GetVar]Entity.GetVar [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionShows how GetVar is like GetTable.
Used onNewerServer.png
Code
 
local lastupdate = MyEnt:GetVar( "LastUpdate", 0 )
 
-- is the same as:
 
local lastupdate
if( MyEnt:GetTable().LastUpdate ~= nil ) then 
	lastupdate = MyEnt:GetTable().LastUpdate
else
	lastupdate = 0
end
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox