Declare which GMod realm a file or function belongs to.
Overview
@realm sets the realm for a file or function. GLuaLS checks it before filename, folder, and if CLIENT/SERVER inference.
Syntax
---@realm client---@realm server---@realm shared
File-level realm
File-level realm annotations are experimental. Use them only when GLuaLS infers the wrong realm for the whole file. Prefer function-level annotations for mixed files.
Place @realm at the top of a file to mark the whole file:
---@realm client-- GLuaLS treats everything in this file as client-sidesurface.DrawRect(0, 0, 100, 100) -- ✅ no realm mismatch warningply:SetHealth(100) -- ❌ server-only function in a client file
Function-level realm
Set the realm for one function inside a shared file:
-- This is a shared file (no top-level @realm)---@realm serverfunction MyAddon.KickPlayer(ply, reason) ply:Kick(reason)end---@realm clientfunction MyAddon.ShowNotification(msg) notification.AddLegacy(msg, NOTIFY_GENERIC, 5)end
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"GLua Language Server","colors":{"primary":"#4A9EFF","light":"#6DB8FF","dark":"#2B7DD9"},"logo":{"light":"https://mintcdn.com/arnux/J15DlKTeBYDlLdNQ/logo/light.svg?fit=max\u0026auto=format\u0026n=J15DlKTeBYDlLdNQ\u0026q=85\u0026s=343a3d23d7e04d7493c1fc2cefe3447e","dark":"https://mintcdn.com/arnux/J15DlKTeBYDlLdNQ/logo/dark.svg?fit=max\u0026auto=format\u0026n=J15DlKTeBYDlLdNQ\u0026q=85\u0026s=679b24e10f43bd42973f95482cde3751"},"favicon":"https://mintcdn.com/arnux/bkVufjXIELu8fSRa/favicon.svg?fit=max\u0026auto=format\u0026n=bkVufjXIELu8fSRa\u0026q=85\u0026s=45aacb5e975f0fab7eb249df37118d44","navbar":{"links":[{"href":"https://github.com/Pollux12/vscode-gmod-glua-ls","label":"GitHub"}],"primary":{"type":"button","label":"Install Extension","href":"https://marketplace.visualstudio.com/items?itemName=Pollux.gmod-glua-ls"}},"footer":{"socials":{"github":"https://github.com/Pollux12/vscode-gmod-glua-ls"}},"contextual":{"options":["copy","view"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"GitHub - VS Code","icon":"github","href":"https://github.com/Pollux12/vscode-gmod-glua-ls"},{"anchor":"GitHub - LS","icon":"github","href":"https://github.com/Pollux12/gmod-glua-ls"},{"anchor":"Issues","icon":"circle-exclamation","href":"https://github.com/Pollux12/gmod-glua-ls/issues"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"arnux","hasAudioNarration":false,"actualSubdomain":"arnux","customDomains":["gluals.arnux.net"],"gitSource":{"type":"github","owner":"pollux12","repo":"gmod-glua-ls","deployBranch":"main","contentDirectory":"docs/mintlify","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6af7c6bb51f81dc05f7c83f2","clientVersion":"0.0.4177","searchFilterCounts":[{"language":"default","tag":"Annotations","count":42},{"language":"default","tag":"Advanced","count":17},{"language":"default","tag":"Guide","count":17},{"language":"default","tag":"Types","count":9},{"language":"default","tag":"Configuration","count":9},{"language":"default","tag":"Functions","count":6},{"language":"default","tag":"Utilities","count":5},{"language":"default","tag":"Realms and hooks","count":4},{"language":"default","tag":"Get started","count":4},{"language":"default","tag":"Debugger","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":true,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"annotations/realm","slug":"/annotations/realm","pageMetadata":{"title":"@realm","description":"Declare which GMod realm a file or function belongs to.","href":"/annotations/realm"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Declare which GMod realm a file or function belongs to.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,hr:`hr`,li:`li`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`overview`,children:`Overview`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`@realm`}),` sets the realm for a file or function. GLuaLS checks it before filename, folder, and `,_jsx(_components.code,{children:`if CLIENT/SERVER`}),` inference.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`syntax`,children:`Syntax`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`---@realm client`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`---@realm server`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`---@realm shared`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsxs(Heading,{level:`2`,id:`file-level-realm`,children:[`File-level realm `,_jsx(`a`,{id:`file-level-realm`})]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`File-level realm annotations are experimental. Use them only when GLuaLS infers the wrong realm for the whole file. Prefer function-level annotations for mixed files.`})}),`\n`,_jsxs(_components.p,{children:[`Place `,_jsx(_components.code,{children:`@realm`}),` at the top of a file to mark the whole file:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`---@realm client`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- GLuaLS treats everything in this file as client-side`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`surface`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`DrawRect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- ✅ no realm mismatch warning`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`SetHealth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- ❌ server-only function in a client file`})]}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsxs(Heading,{level:`2`,id:`function-level-realm`,children:[`Function-level realm `,_jsx(`a`,{id:`function-level-realm`})]}),`\n`,_jsx(_components.p,{children:`Set the realm for one function inside a shared file:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`lua`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`lua`,children:_jsxs(_components.code,{language:`lua`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- This is a shared file (no top-level @realm)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`---@realm server`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` MyAddon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`KickPlayer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`reason`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ply`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Kick`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`reason`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`---@realm client`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` MyAddon`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`ShowNotification`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`msg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` notification`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`AddLegacy`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`msg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`NOTIFY_GENERIC`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`realm-values`,children:`Realm values`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Value`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`client`})}),_jsxs(_components.td,{children:[`Clientside (runs in the `,_jsx(_components.code,{children:`CLIENT`}),` state)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`server`})}),_jsxs(_components.td,{children:[`Serverside (runs in the `,_jsx(_components.code,{children:`SERVER`}),` state)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`shared`})}),_jsx(_components.td,{children:`Both client and server`})]})]})]}),`\n`,_jsxs(Heading,{level:`2`,id:`when-@realm-is-missing`,children:[`When `,_jsx(_components.code,{children:`@realm`}),` is missing`]}),`\n`,_jsx(_components.p,{children:`GLuaLS detects realm from:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Filename prefix (`,_jsx(_components.code,{children:`cl_*`}),`, `,_jsx(_components.code,{children:`sv_*`}),`, `,_jsx(_components.code,{children:`sh_*`}),`)`]}),`\n`,_jsxs(_components.li,{children:[`Directory (`,_jsx(_components.code,{children:`client/`}),`, `,_jsx(_components.code,{children:`server/`}),`, `,_jsx(_components.code,{children:`lua/autorun/client/`}),`, etc.)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`if CLIENT`}),` / `,_jsx(_components.code,{children:`if SERVER`}),` blocks`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Complex files can confuse realm detection.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"@realm","description":"Declare which GMod realm a file or function belongs to.","href":"/annotations/realm"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Overview","slug":"overview","depth":2,"children":[]},{"title":"Syntax","slug":"syntax","depth":2,"children":[]},{"title":"File-level realm ","slug":"file-level-realm","depth":2,"children":[]},{"title":"Function-level realm ","slug":"function-level-realm","depth":2,"children":[]},{"title":"Realm values","slug":"realm-values","depth":2,"children":[]},{"title":"When @realm is missing","slug":"when-@realm-is-missing","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"arnux","siteName":"GLua Language Server","title":"@realm - GLua Language Server","contextualStarterQuestions":[{"_id":"6af7c6c2d7f60a90d19a8e02","deploymentId":"69c1d59f5257c240f1b5b1b9","questionText":"How do I set function realm?","status":"active","generatedBy":"contextual","path":"annotations/realm","createdAt":"2026-11-14T02:26:10.908Z","updatedAt":"2026-11-14T02:26:10.908Z","__v":0},{"_id":"6af7c6c2d7f60a90d19a8e03","deploymentId":"69c1d59f5257c240f1b5b1b9","questionText":"What realm values are available?","status":"active","generatedBy":"contextual","path":"annotations/realm","createdAt":"2026-11-14T02:26:10.908Z","updatedAt":"2026-11-14T02:26:10.908Z","__v":0},{"_id":"6af7c6c2d7f60a90d19a8e04","deploymentId":"69c1d59f5257c240f1b5b1b9","questionText":"When should I use @realm?","status":"active","generatedBy":"contextual","path":"annotations/realm","createdAt":"2026-11-14T02:26:10.908Z","updatedAt":"2026-11-14T02:26:10.908Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-14T02:26:07.061Z","originalFileLocation":"annotations/realm.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Declare which GMod realm a file or function belongs to.\">\u003cmeta data-mint-head name=\"application-name\" content=\"GLua Language Server\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"@realm - GLua Language Server\">\u003cmeta data-mint-head property=\"og:description\" content=\"Declare which GMod realm a file or function belongs to.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"GLua Language Server\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://gluals.arnux.net/annotations/realm\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://arnux.mintlify.site/_mintlify/api/og/v2?division=Realms+and+hooks\u0026amp;title=%40realm\u0026amp;description=Declare+which+GMod+realm+a+file+or+function+belongs+to.\u0026amp;theme=4807c17cf0e5d6f002a940d3\u0026amp;signature=be4ac562f493d32a70d1c73c28ab07ad3031bbc57e82be14bc8377e48a25901f\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"@realm - GLua Language Server\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Declare which GMod realm a file or function belongs to.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://arnux.mintlify.site/_mintlify/api/og/v2?division=Realms+and+hooks\u0026amp;title=%40realm\u0026amp;description=Declare+which+GMod+realm+a+file+or+function+belongs+to.\u0026amp;theme=4807c17cf0e5d6f002a940d3\u0026amp;signature=be4ac562f493d32a70d1c73c28ab07ad3031bbc57e82be14bc8377e48a25901f\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/arnux/g8GsgAtHJpFDa_hB/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"GLua Language Server\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#4A9EFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://gluals.arnux.net/annotations/realm\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/annotations/realm.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://gluals.arnux.net/#organization\",\"name\":\"GLua Language Server\",\"url\":\"https://gluals.arnux.net\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/arnux/J15DlKTeBYDlLdNQ/logo/light.svg?fit=max\u0026auto=format\u0026n=J15DlKTeBYDlLdNQ\u0026q=85\u0026s=343a3d23d7e04d7493c1fc2cefe3447e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://gluals.arnux.net#website\",\"name\":\"GLua Language Server\",\"url\":\"https://gluals.arnux.net\",\"publisher\":{\"@id\":\"https://gluals.arnux.net/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://gluals.arnux.net/annotations/realm#webpage\",\"url\":\"https://gluals.arnux.net/annotations/realm\",\"name\":\"@realm\",\"description\":\"Declare which GMod realm a file or function belongs to.\",\"dateModified\":\"2026-11-14T02:26:07.061Z\",\"isPartOf\":{\"@id\":\"https://gluals.arnux.net#website\"},\"breadcrumb\":{\"@id\":\"https://gluals.arnux.net/annotations/realm#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://gluals.arnux.net/annotations/realm#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"GLua Language Server\",\"item\":\"https://gluals.arnux.net\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"@realm\",\"item\":\"https://gluals.arnux.net/annotations/realm\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://gluals.arnux.net/annotations/realm#article\",\"headline\":\"@realm\",\"name\":\"@realm\",\"description\":\"Declare which GMod realm a file or function belongs to.\",\"url\":\"https://gluals.arnux.net/annotations/realm\",\"mainEntityOfPage\":{\"@id\":\"https://gluals.arnux.net/annotations/realm#webpage\"},\"dateModified\":\"2026-11-14T02:26:07.061Z\",\"publisher\":{\"@id\":\"https://gluals.arnux.net/#organization\"},\"isPartOf\":{\"@id\":\"https://gluals.arnux.net#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"GLua Language Server\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"GLua Language Server\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/annotations/realm.md","siteName":"GLua Language Server","nav":{"global":{"anchors":[{"anchor":"GitHub - VS Code","icon":"github","href":"https://github.com/Pollux12/vscode-gmod-glua-ls"},{"anchor":"GitHub - LS","icon":"github","href":"https://github.com/Pollux12/gmod-glua-ls"},{"anchor":"Issues","icon":"circle-exclamation","href":"https://github.com/Pollux12/gmod-glua-ls/issues"}]},"tabs":[{"tab":"Guide","pages":[{"title":"Guide","href":""}]},{"tab":"Annotations","groups":[{"group":"Overview","pages":[{"title":"Annotations overview","href":"/annotations"}]},{"group":"Types","pages":[{"title":"@class","href":"/annotations/class"},{"title":"@type","href":"/annotations/type"},{"title":"@field","href":"/annotations/field"},{"title":"@index_alias","href":"/annotations/index-alias"},{"title":"@field_accessor","href":"/annotations/field-accessor"},{"title":"@alias","href":"/annotations/alias"},{"title":"@enum","href":"/annotations/enum"},{"title":"@generic","href":"/annotations/generic"},{"title":"@operator","href":"/annotations/operator"}]},{"group":"Functions","pages":[{"title":"@param","href":"/annotations/param"},{"title":"@return","href":"/annotations/return"},{"title":"@overload","href":"/annotations/overload"},{"title":"@outparam","href":"/annotations/outparam"},{"title":"@async","href":"/annotations/async"},{"title":"@nodiscard","description":"Warn when a function's return value is discarded.","href":"/annotations/nodiscard"}]},{"group":"Realms and hooks","pages":[{"title":"@realm","href":"/annotations/realm"},{"title":"@hook","description":"Register a method as a GMod hook handler with named lookup and type inference.","href":"/annotations/hook"},{"title":"@fileparam","href":"/annotations/fileparam"},{"title":"@accessorfunc","href":"/annotations/accessorfunc"}]},{"group":"Utilities","pages":[{"title":"@diagnostic","href":"/annotations/diagnostic"},{"title":"@cast","href":"/annotations/cast"},{"title":"@deprecated","href":"/annotations/deprecated"},{"title":"@see","href":"/annotations/see"},{"title":"@lsp_optimization","href":"/annotations/lsp-optimization"}]},{"group":"Advanced","pages":[{"title":"@call_arg","href":"/annotations/call-arg"},{"title":"@adds_field","href":"/annotations/adds-field"},{"title":"@valid_guard","href":"/annotations/valid-guard"},{"title":"@self_guard","href":"/annotations/self-guard"},{"title":"@self_call_valid","href":"/annotations/self-call-valid"},{"title":"@self_class_name","href":"/annotations/self-class-name"},{"title":"@exhaustive_type_guard","href":"/annotations/exhaustive-type-guard"},{"title":"@return_alias","href":"/annotations/return-alias"},{"title":"@copy_result","href":"/annotations/copy-result"},{"title":"@fresh_result","href":"/annotations/fresh-result"},{"title":"@writes_global","href":"/annotations/writes-global"},{"title":"@net_send","href":"/annotations/net-send"},{"title":"@net_payload","href":"/annotations/net-payload"},{"title":"@builtin_alias","href":"/annotations/builtin-alias"},{"title":"@meta","href":"/annotations/meta"},{"title":"@module","href":"/annotations/module"},{"title":"@source","href":"/annotations/source"}]}]}]},"basePath":"","title":"@realm - GLua Language Server","deploymentId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","buildId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","dynamics":[],"chunks":[]}