earwax.cmd.variable module

Provides the Variable class.

class earwax.cmd.variable.Variable(name: str, type: earwax.cmd.variable.VariableTypes, value: T, id: str = NOTHING)

Bases: typing.Generic, earwax.mixins.DumpLoadMixin

A variable in a game made with the earwax script.

Variables:
  • name – The name of the variable.
  • type – The type of value.
  • value – The value this variable holds.
  • id – The id of this variable.
get_type() → earwax.cmd.variable.VariableTypes

Return the type of this variable.

This method returns a member of VariableTypes.

classmethod load(data: Dict[str, Any], *args) → earwax.cmd.variable.Variable

Load a variable, and check its type.

Parameters:value – The value to load.
class earwax.cmd.variable.VariableTypes

Bases: enum.Enum

Provides the possible types of variable.

Variables:
type_bool = 3
type_float = 1
type_int = 0
type_string = 2