Garry's Mod Wiki

Entity:GetNW2VarProxy

  function Entity:GetNW2VarProxy( any key )

Description

Returns callback function for given NWVar of this entity.

Arguments

1 any key
The key of the NWVar to get callback of.

Returns

1 function
The callback of given NWVar, or nil if not found.
Function argument(s):
1 Entity ent - The entity
2 string name - Name of the NW2Var that has changed
3 any oldval - The old value
4 any newval - The new value

Example

Prints callback function of a NWVar called "Key" of Player 1.

print( Entity(1):GetNW2VarProxy( "Key" ) ) Entity(1):SetNW2VarProxy( "Key", print ) print( Entity(1):GetNW2VarProxy( "Key" ) )
Output:
nil function: builtin#25