darklua
DocumentationTry itGitHub

compute_expression


Added in 0.3.6

This rule computes expressions (that are determined to be static) and replaces them with their result. An expression will not be replaced if it has any side-effects. This can make code smaller, but also make code slightly faster since the computation is now done ahead of time. This rule is influenced by the evaluation system of darklua. As its capacity increases, the rule will be able to compute more complex expressions.

Examples


return 1 + 1
return 10 * 10
return true and 'true' or 'not true'
return 'Hello' .. ' friend!'
InputOutput
return 1 + 1
return 2
return 10 * 10
return 100
return true and 'true' or 'not true'
return 'true'
return 'Hello' .. ' friend!'
return 'Hello friend!'