Module pl.operator

Lua operators available as functions. (similar to the Python module of the same name)

Functions

add (a, b) add two values +
call (fn, ...) apply function to some arguments ()
concat (a, b) concatenate two values (either strings or __concat defined) ..
div (a, b) divide first value by second /
eq (a, b) returns true if arguments are equal ==
ge (a, b) returns true if a is greater or equal to b >=
gt (a, b) returns true if a is greater than b >
index (t, k) get the indexed value from a table []
land (a, b) true if both values evaluate as true (i.e.
le (a, b) returns true if a is less or equal to b <=
len (a) returns length of string or table #
lnot (a) false if value evaluates as true (i.e.
lor (a, b) true if either value evaluate as true (i.e.
lt (a, b) returns true if a is less than b <
mod (a, b) modulo; remainder of a divided by b %
mul (a, b) multiply two values *
neq (a, b) returns true if arguments are not equal ~=
nop (...) the null operation.
pow (a, b) raise first to the power of second ^
sub (a, b) subtract b from a -
table (...) make a table from the arguments.
unm (a) return the negative of a value -


Functions

add (a, b)
add two values +

Parameters:

  • a: value
  • b: value
call (fn, ...)
apply function to some arguments ()

Parameters:

  • fn: a function or callable object
  • ...:
concat (a, b)
concatenate two values (either strings or __concat defined) ..

Parameters:

  • a: value
  • b:
div (a, b)
divide first value by second /

Parameters:

  • a: value
  • b: value
eq (a, b)
returns true if arguments are equal ==

Parameters:

  • a: value
  • b: value
ge (a, b)
returns true if a is greater or equal to b >=

Parameters:

  • a: value
  • b: value
gt (a, b)
returns true if a is greater than b >

Parameters:

  • a: value
  • b: value
index (t, k)
get the indexed value from a table []

Parameters:

  • t: a table or any indexable object
  • k: the key
land (a, b)
true if both values evaluate as true (i.e. not nil or false) and

Parameters:

  • a: value
  • b:
le (a, b)
returns true if a is less or equal to b <=

Parameters:

  • a: value
  • b: value
len (a)
returns length of string or table #

Parameters:

  • a: a string or a table
lnot (a)
false if value evaluates as true (i.e. not nil or false) not

Parameters:

  • a: value
lor (a, b)
true if either value evaluate as true (i.e. not nil or false) or

Parameters:

  • a: value
  • b:
lt (a, b)
returns true if a is less than b <

Parameters:

  • a: value
  • b: value
mod (a, b)
modulo; remainder of a divided by b %

Parameters:

  • a: value
  • b: value
mul (a, b)
multiply two values *

Parameters:

  • a: value
  • b: value
neq (a, b)
returns true if arguments are not equal ~=

Parameters:

  • a: value
  • b: value
nop (...)
the null operation.

Parameters:

  • ...: arguments

Return value:

    the arguments
pow (a, b)
raise first to the power of second ^

Parameters:

  • a: value
  • b: value
sub (a, b)
subtract b from a -

Parameters:

  • a: value
  • b: value
table (...)
make a table from the arguments. {}

Parameters:

  • ...: non-nil arguments

Return value:

    a table
unm (a)
return the negative of a value -

Parameters:

  • a: value

Valid XHTML 1.0!