-
-
Notifications
You must be signed in to change notification settings - Fork 35
Home
Ketho edited this page Aug 9, 2024
·
16 revisions
The AddOn namespace needs to be annotated with @class in each file. This way the language server knows about the shared table and also allows you to mutate it.
file1.lua
---@class ns
local ns = select(2, ...)
ns.foo = "hello"
file2.lua
---@class ns
local ns = select(2, ...)
ns.bar = "world"
The class name (e.g. ns
) does not need to be unique unless there are multiple addons in your workspace, but it would still be a good practice.
If you intend to use deprecated APIs for Classic, the warning and strikethrough can be removed by disabling its diagnostic.