Skip to main content

Overview

@meta marks a file as a type-only declaration file. GLuaLS reads it for type information. Your addon does not run it. Use this for meta libraries, including the wiki-generated Garry’s Mod annotations (view them here).

Syntax

---@meta
---@meta library_name

Usage

Use meta files to define types for:
  • External libraries
  • Built-in APIs
  • Code without implementation source
---@meta

---@class JSONLib
local json = {}

---@param str string
---@return table
function json.decode(str) end

---@param value table
---@return string
function json.encode(value) end

return json

Named meta files

Add a name after @meta to connect the file to a library name for documentation and tooling:
---@meta mylib

Common uses

  • Bundled GMod annotations: GLuaLS ships GMod API annotations as meta files
  • Third-party library stubs: declare types for libraries loaded at runtime
  • Custom type files: define extra types used across your workspace

Meta files in workspace configuration

Add meta files or directories to workspace.library so GLuaLS analyzes them without treating them as project code:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "workspace": {
    "library": ["./types", "./vendor/stubs"]
  }
}

See also