1lytics

Logical functions

Gorgeous Karnaugh scripting engine provides some logical functions to replace and extend Lua logical operators. Main difference between Gorgeous Karnaugh logical functions and Lua logical operators is in interpretation of values and its conversions to logical true and false. All Lua logical operators consider both false and nil as false and anything else as true, instead of this Gorgeous Karnaugh logical functions consider nil, false and numeric 0 as false and anything else as true. All Gorgeous Karnaugh logical functions have prefix 'l' to differ with Lua operators and doesn't have the 'gk' prefix to make names shorter.

  • lnot - performs logical negation (or complement) of input value.
  • land - performs logical multiplication (conjunction) of input values
  • lnand - the short form for expression lnot(land(...))
  • lor - performs logical addition (disjunction) of input values
  • lnor - the short form for expression lnot(lor(...))
  • lxor - performs logical 'exclusive or' operation of input values
  • lxnor - the short form for expression lnot(lxor(...))
  • lequ - performs logical 'equivalence' operation of input values
  • lnequ - the short form for expression lnot(lequ(...))
  • limpl - performs logical 'implication' operation of input values
  • lnimpl - the short form for expression lnot(limpl(...))

lnot

The lnot logical function performs logical negation (or complement) of input value.

Usage

lnot(val)

land

The land logical function performs logical multiplication (conjunction) of input values. It accepts unlimited number of input values, but it can't be less than 2.

Usage

land(val1,val2[,...])

lnand

The lnand function is the short form for expression lnot(land(...)).

Usage

lnand(val1,val2[,...])

lor

The lor logical function performs logical addition (disjunction) of input values. It accepts unlimited number of input values, but it can't be less than 2.

Usage

lor(val1,val2[,...])

lnor

The lnor function is the short form for expression lnot(lor(...)).

Usage

lnor(val1,val2[,...])

lxor

The lxor logical function performs logical 'exclusive or' operation of input values. It accepts unlimited number of input values, but it can't be less than 2. Meaning of this operation for number of inputs greater then 2 you can see in sample near below.

Usage

lxor(val1,val2[,...])

lxnor

The lxnor function is the short form for expression lnot(lxor(...)).

Usage

lxnor(val1,val2[,...])

lequ

The lequ logical function performs logical 'equivalence' operation of input values. It accepts unlimited number of input values, but it can't be less than 2. Meaning of this operation for number of inputs greater then 2 you can see in sample near below.

Usage

lequ(val1,val2[,...])

lnequ

The lnequ function is the short form for expression lnot(lequ(...)).

Usage

lnequ(val1,val2[,...])

limpl

The limpl logical function performs logical 'implication' operation of input values. It accepts exact 2 input values. Meaning of this operation you can see in sample near below.

Usage

limpl(val1,val2)

lnimpl

The lnimpl function is the short form for expression lnot(limpl(...)).

Usage

lnimpl(val1,val2)