Module Logic

N-Argument logic operators.

Module Status: Experimental 2020-10-31.

Usage:

    local Logic = require('__eradicators-library__/erlib/factorio/Logic')()
    

Basic

And(...) And-compares an arbitrary number of objects for truthyness.
Or(...) Or-compares an arbitrary number of objects for truthyness.
Xor(...) Exclusive-Or-compares an arbitrary number of objects for truthyness.

Advanced

Andy(...) And-compares an arbitrary number of objects for truthyness.
Ory(...) Or-compares an arbitrary number of objects for truthyness.
Xory(...) Exclusive-Or-compares two objects for truthyness.


Basic

And(...)
And-compares an arbitrary number of objects for truthyness.

Parameters:

  • ...

Returns:

    boolean True if all objects were truthy.
Or(...)
Or-compares an arbitrary number of objects for truthyness.

Parameters:

  • ...

Returns:

    boolean True if at least one object was truthy.
Xor(...)
Exclusive-Or-compares an arbitrary number of objects for truthyness.

Parameters:

  • ...

Returns:

    boolean True if exactly one object was truthy.

Advanced

Advanced functions return one of the objects instead of boolean.
Andy(...)
And-compares an arbitrary number of objects for truthyness.

Parameters:

Returns:

    AnyValue or false The last truthy object if Logic.And(...) would've been true.
Ory(...)
Or-compares an arbitrary number of objects for truthyness.

Parameters:

Returns:

    AnyValue The first truthy object if Logic.Or(...) would've been true.
Xory(...)
Exclusive-Or-compares two objects for truthyness.

Parameters:

Returns:

    AnyValue or false The only truthy object if Logic.Xor(...) would've been true.
generated by LDoc 1.4.6 Last updated 2021-09-10 19:51:19