ryvencore.script_variables.VarsManager module - ryvencore v0.1.0 documentation

Hide navigation sidebar
Hide table of contents sidebar
Toggle table of contents sidebar

# ryvencore.script_variables.VarsManager module

class VarsManager(script, load_data=None)

  Bases: `ryvencore.Base.Base`

  Manages script variables and triggers receivers when values of variables change

  new_var_created = <ryvencore.Base.Event object>
  var_deleted = <ryvencore.Base.Event object>
  var_val_changed = <ryvencore.Base.Event object>
  var_name_valid(name: str) → bool

    Checks if a var name candidate is valid

  create_new_var(name: str, val=None) → ryvencore.script_variables.Variable.Variable

    Creates and returns a new script variable and None if the name isn’t valid

  get_var(name) → ryvencore.script_variables.Variable.Variable

    Returns script variable with given name or None if it couldn’t be found

  get_var_val(name)

    Returns the value of a script variable with given name or None if it couldn’t be found

  set_var(name, val) → bool

    Sets the value of an existing script variable. Returns true in case of success, false if the var couldn’t be found and set.

  delete_var(var: ryvencore.script_variables.Variable.Variable)

    Deletes a variable

  register_receiver(receiver, var_name: str, method)

    A registered receiver (method) gets triggered every time the value of a variable with the given name changes (also when it gets created).

  unregister_receiver(receiver, var_name: str, method) → bool

    Unregisters a method and returns true in case of success. See also register_receiver().

  data() → dict

    converts the object to a JSON compatible dict for serialization