Replies: 1 comment 4 replies
-
I have just found a very hacky way to do so 😂 ---@class (exact) colors.*
---@enum colors
local COLORS = { ---@class colors.*
black = 0,
red = 2,
green = 4,
yellow = 8,
blue = 16,
white = 32
}
COLORS.black = 255 -- warning: inject-field Explanation (I think it works this way, or is it?) 😂
---@class (exact) Foo
---@field foo1 integer
---@field foo2 integer
Foo = {}
Foo.foo1 = 1 -- ok
Foo.foo2 = 2 -- ok
Foo.foo3 = 3 -- warn: inject-field
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any way to make a value immutable? Like treating it as a constant, enum, etc.
So that a warning is triggered if you try to do something like this:
Or to be able to mark a class field as constant.
Beta Was this translation helpful? Give feedback.
All reactions