Larger and Smaller Operators
Supported platforms:
Available since: Gideros 2017.10
Description
Operators to return the larger or smaller of two values.
a<>b compares 'a' and 'b', returns the larger of them.
a><b compares 'a' and 'b', returns the smaller of them.
Examples
Simple larger examples <syntaxhighlight lang="lua"> x=a<>b -- faster than x=math.max(a,b) x=(x-1)<>5 -- decrement x, but don't go below 5 </source>
Simple smaller examples <syntaxhighlight lang="lua"> x=a><15 -- increment x, but don't go above 15 </source>
Make sure x is within bounds example <syntaxhighlight lang="lua"> x=(x<>min)><max </source>
Always return the negative of a number <syntaxhighlight lang="lua"> x=-x><x -- faster than -math.abs </source>
Always return the positive of a number <syntaxhighlight lang="lua"> x=-x<>x -- faster than math.abs </source>