Expressions

class Expression

A server side expression.

static constant_double(value)

A constant value of double precision floating point type.

Parameters:value (double) –
Return type:Expression
Game Scenes:All
static constant_float(value)

A constant value of single precision floating point type.

Parameters:value (float) –
Return type:Expression
Game Scenes:All
static constant_int(value)

A constant value of integer type.

Parameters:value (int) –
Return type:Expression
Game Scenes:All
static constant_bool(value)

A constant value of boolean type.

Parameters:value (bool) –
Return type:Expression
Game Scenes:All
static constant_string(value)

A constant value of string type.

Parameters:value (str) –
Return type:Expression
Game Scenes:All
static call(call)

An RPC call.

Parameters:call (krpc.schema.KRPC.ProcedureCall) –
Return type:Expression
Game Scenes:All
static equal(arg0, arg1)

Equality comparison.

Parameters:
Return type:

Expression

Game Scenes:

All

static not_equal(arg0, arg1)

Inequality comparison.

Parameters:
Return type:

Expression

Game Scenes:

All

static greater_than(arg0, arg1)

Greater than numerical comparison.

Parameters:
Return type:

Expression

Game Scenes:

All

static greater_than_or_equal(arg0, arg1)

Greater than or equal numerical comparison.

Parameters:
Return type:

Expression

Game Scenes:

All

static less_than(arg0, arg1)

Less than numerical comparison.

Parameters:
Return type:

Expression

Game Scenes:

All

static less_than_or_equal(arg0, arg1)

Less than or equal numerical comparison.

Parameters:
Return type:

Expression

Game Scenes:

All

static and_(arg0, arg1)

Boolean and operator.

Parameters:
Return type:

Expression

Game Scenes:

All

static or_(arg0, arg1)

Boolean or operator.

Parameters:
Return type:

Expression

Game Scenes:

All

static exclusive_or(arg0, arg1)

Boolean exclusive-or operator.

Parameters:
Return type:

Expression

Game Scenes:

All

static not_(arg)

Boolean negation operator.

Parameters:arg (Expression) –
Return type:Expression
Game Scenes:All
static add(arg0, arg1)

Numerical addition.

Parameters:
Return type:

Expression

Game Scenes:

All

static subtract(arg0, arg1)

Numerical subtraction.

Parameters:
Return type:

Expression

Game Scenes:

All

static multiply(arg0, arg1)

Numerical multiplication.

Parameters:
Return type:

Expression

Game Scenes:

All

static divide(arg0, arg1)

Numerical division.

Parameters:
Return type:

Expression

Game Scenes:

All

static modulo(arg0, arg1)

Numerical modulo operator.

Parameters:
Returns:

The remainder of arg0 divided by arg1

Return type:

Expression

Game Scenes:

All

static power(arg0, arg1)

Numerical power operator.

Parameters:
Returns:

arg0 raised to the power of arg1, with type of arg0

Return type:

Expression

Game Scenes:

All

static left_shift(arg0, arg1)

Bitwise left shift.

Parameters:
Return type:

Expression

Game Scenes:

All

static right_shift(arg0, arg1)

Bitwise right shift.

Parameters:
Return type:

Expression

Game Scenes:

All

static cast(arg, type)

Perform a cast to the given type.

Parameters:
Return type:

Expression

Game Scenes:

All

static parameter(name, type)

A named parameter of type double.

Parameters:
  • name (str) – The name of the parameter.
  • type (Type) – The type of the parameter.
Returns:

A named parameter.

Return type:

Expression

Game Scenes:

All

static function(parameters, body)

A function.

Parameters:
  • parameters (list) – The parameters of the function.
  • body (Expression) – The body of the function.
Returns:

A function.

Return type:

Expression

Game Scenes:

All

static invoke(function, args)

A function call.

Parameters:
  • function (Expression) – The function to call.
  • args (dict) – The arguments to call the function with.
Returns:

A function call.

Return type:

Expression

Game Scenes:

All

static create_tuple(elements)

Construct a tuple.

Parameters:elements (list) – The elements.
Returns:The tuple.
Return type:Expression
Game Scenes:All
static create_list(values)

Construct a list.

Parameters:values (list) – The value. Should all be of the same type.
Returns:The list.
Return type:Expression
Game Scenes:All
static create_set(values)

Construct a set.

Parameters:values (set) – The values. Should all be of the same type.
Returns:The set.
Return type:Expression
Game Scenes:All
static create_dictionary(keys, values)

Construct a dictionary, from a list of corresponding keys and values.

Parameters:
  • keys (list) – The keys. Should all be of the same type.
  • values (list) – The values. Should all be of the same type.
Returns:

The dictionary.

Return type:

Expression

Game Scenes:

All

static to_list(arg)

Convert a collection to a list.

Parameters:arg (Expression) – The collection.
Returns:The collection as a list.
Return type:Expression
Game Scenes:All
static to_set(arg)

Convert a collection to a set.

Parameters:arg (Expression) – The collection.
Returns:The collection as a set.
Return type:Expression
Game Scenes:All
static get(arg, index)

Access an element in a tuple, list or dictionary.

Parameters:
  • arg (Expression) – The tuple, list or dictionary.
  • index (Expression) – The index of the element to access. A zero indexed integer for a tuple or list, or a key for a dictionary.
Returns:

The element.

Return type:

Expression

Game Scenes:

All

static count(arg)

Number of elements in a collection.

Parameters:arg (Expression) – The list, set or dictionary.
Returns:The number of elements in the collection.
Return type:Expression
Game Scenes:All
static sum(arg)

Sum all elements of a collection.

Parameters:arg (Expression) – The list or set.
Returns:The sum of the elements in the collection.
Return type:Expression
Game Scenes:All
static max(arg)

Maximum of all elements in a collection.

Parameters:arg (Expression) – The list or set.
Returns:The maximum elements in the collection.
Return type:Expression
Game Scenes:All
static min(arg)

Minimum of all elements in a collection.

Parameters:arg (Expression) – The list or set.
Returns:The minimum elements in the collection.
Return type:Expression
Game Scenes:All
static average(arg)

Minimum of all elements in a collection.

Parameters:arg (Expression) – The list or set.
Returns:The minimum elements in the collection.
Return type:Expression
Game Scenes:All
static select(arg, func)

Run a function on every element in the collection.

Parameters:
Returns:

The modified collection.

Return type:

Expression

Game Scenes:

All

static where(arg, func)

Run a function on every element in the collection.

Parameters:
Returns:

The modified collection.

Return type:

Expression

Game Scenes:

All

static contains(arg, value)

Determine if a collection contains a value.

Parameters:
Returns:

Whether the collection contains a value.

Return type:

Expression

Game Scenes:

All

static aggregate(arg, func)

Applies an accumulator function over a sequence.

Parameters:
Returns:

The accumulated value.

Return type:

Expression

Game Scenes:

All

static aggregate_with_seed(arg, seed, func)

Applies an accumulator function over a sequence, with a given seed.

Parameters:
Returns:

The accumulated value.

Return type:

Expression

Game Scenes:

All

static concat(arg1, arg2)

Concatenate two sequences.

Parameters:
Returns:

The first sequence followed by the second sequence.

Return type:

Expression

Game Scenes:

All

static order_by(arg, key)

Order a collection using a key function.

Parameters:
  • arg (Expression) – The collection to order.
  • key (Expression) – A function that takes a value from the collection and generates a key to sort on.
Returns:

The ordered collection.

Return type:

Expression

Game Scenes:

All

static all(arg, predicate)

Determine whether all items in a collection satisfy a boolean predicate.

Parameters:
Returns:

Whether all items satisfy the predicate.

Return type:

Expression

Game Scenes:

All

static any(arg, predicate)

Determine whether any item in a collection satisfies a boolean predicate.

Parameters:
Returns:

Whether any item satisfies the predicate.

Return type:

Expression

Game Scenes:

All

class Type

A server side expression.

static double()

Double type.

Return type:Type
Game Scenes:All
static float()

Float type.

Return type:Type
Game Scenes:All
static int()

Int type.

Return type:Type
Game Scenes:All
static bool()

Bool type.

Return type:Type
Game Scenes:All
static string()

String type.

Return type:Type
Game Scenes:All