pub struct Helpers { /* private fields */ }Expand description
Helper surface injected before every invocation.
The runtime always defines the upstream helper vect and the six constant
objects Map, Hero, Gamemode, Color, Team, Button (see
builtInJsFunctions in the OverPy reference src/globalVars.ts). The
constant entries are Workshop catalog data that workshop-rs owns, so this
crate ships them empty; populate them with Helpers::set_constant.
Implementations§
Source§impl Helpers
impl Helpers
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty helper set: only the builtin vect function and the
six empty constant objects exist.
Sourcepub fn set_constant(&mut self, object: &str, key: &str, value: &str)
pub fn set_constant(&mut self, object: &str, key: &str, value: &str)
Adds one key -> value entry to the constant object object.
Matches the upstream ABI where each entry is an UPPER_SNAKE key mapped
to a string carrying the object prefix, e.g.
set_constant("Map", "KANEZAKA", "Map.KANEZAKA") makes
Map.KANEZAKA === "Map.KANEZAKA" inside scripts.