MCPcopy Create free account
hub / github.com/PerroEngine/Perro / set_var

Method set_var

perro_source/runtime_project/perro_runtime/src/rt_ctx/scripts.rs:51–68  ·  view source on GitHub ↗
(&self, state: &mut dyn Any, var: ScriptMemberID, value: Variant)

Source from the content-addressed store, hash-verified

49 }
50
51 fn set_var(&self, state: &mut dyn Any, var: ScriptMemberID, value: Variant) {
52 let Some(state) = state.downcast_mut::<BenchScriptState>() else {
53 return;
54 };
55 match var.0 {
56 1 => {
57 if let Some(value) = value.as_i64() {
58 state.frame = value.max(0) as u64;
59 }
60 }
61 2 => {
62 if let Some(value) = value.as_i32() {
63 state.hp = value;
64 }
65 }
66 _ => {}
67 }
68 }
69
70 fn call_method(
71 &self,

Callers

nothing calls this directly

Calls 4

as_i64Method · 0.80
with_instance_mutMethod · 0.80
maxMethod · 0.45
as_i32Method · 0.45

Tested by

no test coverage detected