From 5841809fbf165f92520ab17412b850c7c197394c Mon Sep 17 00:00:00 2001 From: ShadowMario <44785097+ShadowMario@users.noreply.github.com> Date: Sun, 15 Sep 2024 18:36:11 -0300 Subject: [PATCH] Fixed "Tried to call a non-function" errors --- source/psychlua/HScript.hx | 2 +- source/states/PlayState.hx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/psychlua/HScript.hx b/source/psychlua/HScript.hx index ef1191a0b7a..dc52f861153 100644 --- a/source/psychlua/HScript.hx +++ b/source/psychlua/HScript.hx @@ -346,7 +346,7 @@ class HScript extends Iris return null; } - public function executeFunction(funcToRun:String = null, funcArgs:Array):IrisCall { + public function executeFunction(funcToRun:String = null, funcArgs:Array = null):IrisCall { if (funcToRun == null || !exists(funcToRun)) return null; return call(funcToRun, funcArgs); } diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index ed86701353f..cd20c82fc66 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -3097,7 +3097,7 @@ class PlayState extends MusicBeatState for (script in hscriptArray) if(script != null) { - script.call('onDestroy'); + script.executeFunction('onDestroy'); script.destroy(); } @@ -3260,7 +3260,7 @@ class PlayState extends MusicBeatState try { newScript = new HScript(null, file); - newScript.call('onCreate'); + newScript.executeFunction('onCreate'); trace('initialized hscript interp successfully: $file'); hscriptArray.push(newScript); }