From c2e02efc479c3653a9c0a6bd415925f612064d4a Mon Sep 17 00:00:00 2001 From: Akulij Date: Mon, 19 May 2025 23:54:39 +0500 Subject: [PATCH] create call_context method for BotFunction --- src/botscript.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/botscript.rs b/src/botscript.rs index 77edc28..4f6430b 100644 --- a/src/botscript.rs +++ b/src/botscript.rs @@ -20,6 +20,13 @@ pub type ScriptResult = Result; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct BotFunction(String); // temporal workaround +impl BotFunction { + pub fn call_context(&self, runner: &Runner) -> ScriptResult { + let func_name = &self.0; + + runner.run_script(&format!("{func_name}()")) + } +} // TODO: remove this function since it is suitable only for early development #[allow(clippy::print_stdout)] fn print(s: String) {