External global variables #3233
Answered
by
tomlau10
TracerDS
asked this question in
General Questions
Answered by
tomlau10
Jul 20, 2025
Replies: 1 comment 2 replies
I assume you are talking about the What you actually want might be create a meta definition file and then define your globals with values there 🤔
---@meta
MyGlobalVar = 123This pattern is used by LuaLS's repo as well: https://github.com/LuaLS/lua-language-server/blob/master/script/global.d.lua |
2 replies
Answer selected by
TracerDS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


I assume you are talking about the
diagnostics.globalssettings: https://luals.github.io/wiki/settings/#diagnosticsglobalsAFAIK, this is actually NOT the best practice because the server cannot infer type from it, it is only used to mute relevant undefined global warnings.
What you actually want might be create a meta definition file and then define your globals with values there 🤔
https://luals.github.io/wiki/definition-files/
This pattern is used by LuaLS's repo as well: https://github.com/LuaLS/lua-language-server/blob/master/script/global.d.lua