darklua
DocumentationTry itGitHub

remove_if_expression


unreleased

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 }