Skip to content

Networking

This page documents hooks in the networking category.


NetVarChanged(entity, key, oldValue, newValue)View Source

Purpose

Runs after a networked variable changes. This file triggers it for global networked variables with `entity` set to nil.

Category

Networking

Realm

Server

Parameters

Entity entity optional The entity whose networked variable changed, or nil when a global networked variable changed.

string key The networked variable key that changed.

any oldValue The previous value stored for the key.

any newValue The new value stored for the key.

Example Usage

  hook.Add("NetVarChanged", "liaExampleNetVarChanged", function(entity, key, oldValue, newValue)
      print("[MyModule] handled NetVarChanged")
  end)

OnLocalVarSet(key, value)View Source

Purpose

Runs after the local player receives an updated local netvar so client modules can react to predicted stamina changes or other local-only state.

Category

Networking

Realm

Client

Parameters

string key The local netvar name that was updated.

any value The new local netvar value that was received.

Example Usage

  hook.Add("OnLocalVarSet", "liaExampleOnLocalVarSet", function(key, value)
      if key == "stamina" then
          print("Stamina updated:", value)
      end
  end)