Skip to main content

Overview

@deprecated marks a function, field, or class as deprecated. When your code uses that symbol, GLuaLS reports a deprecated diagnostic (hint by default) and shows strikethrough in completions.

Syntax

---@deprecated
---@deprecated Alternative or explanation

Basic deprecation

---@deprecated
function OldPlayerJoin(ply)
    -- ...
end
Calls to OldPlayerJoin show a deprecation hint.

With a migration message

GLuaLS shows the message in the diagnostic and hover documentation:
---@deprecated Use PLUGIN:OnPlayerSpawn(ply) instead
function OldSpawnHandler(ply)
    -- ...
end

Deprecated fields

---@class GameConfig
---@field maxPlayers number Max players allowed
---@field playerLimit number @deprecated Use maxPlayers instead

Deprecated class

---@deprecated Use NewPlayerManager instead
---@class OldPlayerManager
local OldPlayerManager = {}

Severity

The deprecated diagnostic uses hint severity by default (subtle underline). You can change it:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "diagnostics": {
    "severity": {
      "deprecated": "warning"
    }
  }
}