Skip to main content

Overview

@param declares the type and optional description of each function parameter. Place one @param per parameter, directly above the function definition.

Syntax


Basic usage


Optional parameters

Add ? after the name to mark the parameter as nil in some calls:

Union types


Variadic parameters

Use ... as the parameter name for variadic arguments:

Function-type parameters


Table-type parameters


Generic parameters


String-template generic parameters

Use backticks when the parameter is a class-name string:
For functions accepting either a class object or class-name string:
Rule:
  • T treats "some_text" as string
  • `T` treats "some_text" as a class/type name

self parameter

GLuaLS types self as the owning class for methods. Annotate only when you want to be explicit:

Interplay with @fileparam

GLuaLS applies file-level defaults from @fileparam, then workspace defaults from gmod.fileParamDefaults. Explicit @param takes highest priority.