From e4072ea33668412fc27f1d97d54818ba97d3b538 Mon Sep 17 00:00:00 2001 From: Tapple Gao Date: Sat, 10 Jan 2026 17:37:59 -0800 Subject: [PATCH] Document MisleadingCondition warning in lint.md Add explanation for MisleadingCondition warning in Luau. --- src/content/docs/getting-started/lint.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/content/docs/getting-started/lint.md b/src/content/docs/getting-started/lint.md index c9cfcbc..d962ac2 100644 --- a/src/content/docs/getting-started/lint.md +++ b/src/content/docs/getting-started/lint.md @@ -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 +```