darklua
DocumentationTry itGitHub

remove_if_expression


Added in 0.14.1

This rule removes all if expressions (not if statements!) and replaces them with an equivalent expression.

Note: this rule is useful if you are converting Luau code into regular Lua code.

Examples


local variable = if condition() then { option = true } else { option = false }
InputOutput
local variable = if condition() then { option = true } else { option = false }
local variable = condition() and{ option = true } or{ option = false }