Garry's Mod Wiki

Entity:SetNWVarProxy

Entity:SetNWVarProxy( any key, function callback )

Description

Sets a function to be called when the NWVar changes.

Arguments

1 any key
The key of the NWVar to add callback for.
2 function callback
The function to be called when the NWVar changes. It has 4 arguments:

  • Entity ent - The entity
  • string name - Name of the NWVar that has changed
  • any oldval - The old value
  • any newval - The new value

Example

Prints all changes to a NWVar called "Key" of Player 1.

Entity( 1 ):SetNWVarProxy( "Key", print ) Entity( 1 ):SetNWString( "Key", "Value" ) Entity( 1 ):SetNWString( "Key", "Table" )
Output: Player [1][Player1] Key nil Value Player [1][Player1] Key Value Table

Page Links


Special Pages


Wikis

?

Render Time: 32ms

DB GetPage 5
Generate Html 6
SaveChanges (1) 8
Render Body 0
Render Sidebar 10