Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/content/docs/getting-started/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,20 @@ end
if 1 <= x <= 3 then
end
```

## MisleadingCondition (30)

Luau is very strict about what evaluates to `false`: only `nil` and `false`. Some programmers are not used to this and try to also test numbers, strings, and tables. This warning flags conditions that are likely erroneous:

```luau
--!hidden mode=nocheck
x = 0
-- (num) is always true; did you mean (num ~= 0)?
if x then
end

s = ""
-- (str) is always true; did you mean (str ~= "")?
if s then
end
```