[−][src]Macro screeps::mem_set
Set a value in memory given a path, creating dicts for intermediate places if they do not exist.
Return
This macro produces a Result<(), ::screeps::memory::UnexpectedTypeError>
. The error path will
trigger if any of the intermediate memory keys exist but are not dictionaries.
Examples
Set Memory.creeps.John.count to 42.
#[macro_use] extern crate screeps; let mem = screeps::memory::root(); mem_set!(mem.creeps.John.count = 42).unwrap();
Set something using a variable path.
#[macro_use] extern crate screeps; let mem = screeps::memory::root(); let creep_name = "John"; let what_to_set = "count"; mem_set!(mem.creeps[creep_name][what_to_set] = 51).unwrap(); mem_set!(mem.creeps[creep_name].count = 52).unwrap();