mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-13 21:40:43 +00:00
parent
a0cd6aa160
commit
3be82035bf
1 changed files with 12 additions and 0 deletions
12
docs/lint.md
12
docs/lint.md
|
@ -216,3 +216,15 @@ local str = ("%d %"):format(1, 2)
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that with the exception of `string.format` this only works when the function is called via the library, not via the method call (so prefer `string.match(s, "pattern")` to `s:match("pattern")`).
|
Note that with the exception of `string.format` this only works when the function is called via the library, not via the method call (so prefer `string.match(s, "pattern")` to `s:match("pattern")`).
|
||||||
|
|
||||||
|
## TableLiteral (19)
|
||||||
|
|
||||||
|
Table literals are often used in Luau to create objects or specify data. The syntax for table literals is rich but invites mistakes, for example it allows duplicate keys or redundant index specification for values already present in the list form. This warning is emitted for cases where some entries in the table literal are ignored at runtime as they're duplicate:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
print({
|
||||||
|
first = 1,
|
||||||
|
second = 2,
|
||||||
|
first = 3, -- Table field 'first' is a duplicate; previously defined at line 2
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue