[−][src]Macro screeps::mem_get
Get a value from memory given a path, returning None
if any thing along
the way does not exist.
Examples
Get a reference with type u32 at the path creeps.John.count.
#[macro_use] extern crate screeps; let mem = screeps::memory::root(); let val = mem_get!(mem.creeps.John.count.i32);
Get something using a variable path.
#[macro_use] extern crate screeps; let mem = screeps::memory::root(); let creep_name = "John"; let what_to_get = "count"; let val1 = mem_get!(mem.creeps[creep_name][what_to_get].i32); let val2 = mem_get!(mem.creeps[creep_name].count.i32); assert_eq!(val1, val2);
Accepted suffixes for type are methods that exist on MemoryReference
, such
as num
, int
, string
, bool
, arr
and dict
.