You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/wiki/diagnostics.mdx
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -473,6 +473,27 @@ local e = nil
473
473
474
474
</Diagnostic>
475
475
476
+
<Diagnosticlevel="Warning">
477
+
<Fragmentslot="name">
478
+
### inject-field
479
+
</Fragment>
480
+
Triggered when injecting an undefined field into a class instance. This can be solved by adding the [`@field`](/wiki/annotations#field) to the class or by using [`@class`](/wiki/annotations#class) directly on the instance.
481
+
482
+
```Lua
483
+
---@classCar
484
+
---@fieldtopSpeednumber
485
+
---@fieldseatsinteger
486
+
487
+
---@typeCar
488
+
localmyCar= { topSpeed=180, seats=5 }
489
+
490
+
-- wheels was not defined in the Car class
491
+
-- because myCar was marked an instance of Car outside the definition of the Car class, its fields are strictly enforced
0 commit comments