Overview
Guard metadata tells GLuaLS that a function proves a value is safe to use. Most addons do not need these annotations. The official annotations already use them for common Garry’s Mod helpers and callbacks. Use guard metadata only when a wrapper or callback has the same runtime guarantee as the API it represents.valid_guard
Use valid_guard on a function that returns TypeGuard<T> and proves its first argument is valid.
Place it after the @return line.
self_guard
Use self_guard on a colon method that proves its receiver is valid after the call.
Place it after the @return or @return_cast line.
self_call_valid
Use self_call_valid on callbacks where a specific self method is known to return a valid value.
self:GetOwner() can be treated as valid.
This is callback-scoped. It does not propagate into helper methods called by the callback.
Member guards
Usegmod.member_guard through @call_arg when a function argument names the member being guarded.