Trait eos_rs::api::script_vars::ScriptVariableWrite
source · pub trait ScriptVariableWrite: ScriptVariableRead {
// Provided methods
fn zero_init(&mut self, var_id: ScriptVariableId) { ... }
fn write_raw(&mut self, value: i32) { ... }
fn write_raw_indexed(&mut self, index: i32, value: i32) { ... }
fn write(&mut self, value: ScriptVariableValue) { ... }
unsafe fn write_as_scenario(&mut self, value1: u8, value2: u8) { ... }
fn write_indexed(&mut self, index: i32, value: ScriptVariableValue) { ... }
}
Expand description
Write actions for script variables.
Provided Methods§
sourcefn zero_init(&mut self, var_id: ScriptVariableId)
fn zero_init(&mut self, var_id: ScriptVariableId)
Zero-initialize the values of the given script variable.
sourcefn write_raw_indexed(&mut self, index: i32, value: i32)
fn write_raw_indexed(&mut self, index: i32, value: i32)
Writes the given value to a script variable at the given index (if this is an array).
Panics if the write is out of bounds.
sourcefn write(&mut self, value: ScriptVariableValue)
fn write(&mut self, value: ScriptVariableValue)
Writes the given value to a script variable.
If this is an array, it’s written to position 0. Special case: If the type is a string, the entire string is written. Panics if the string would overflow the array.
If the value type doesn’t match, this panics.
sourceunsafe fn write_as_scenario(&mut self, value1: u8, value2: u8)
unsafe fn write_as_scenario(&mut self, value1: u8, value2: u8)
Writes to the given variable as if it were a scenario variable.
Safety
You must make sure yourself that this variable is a scenario variable. No bounds or type checking is done.
sourcefn write_indexed(&mut self, index: i32, value: ScriptVariableValue)
fn write_indexed(&mut self, index: i32, value: ScriptVariableValue)
Writes the given value to a script variable (if this is an array).
Panics if the write is out of bounds.
If the value type doesn’t match, this panics.
For string type variables, the input value must be a valid single-character CString. Only the character at the specified index is changed.