9 Commits

2 changed files with 14 additions and 15 deletions

View File

@ -28,7 +28,7 @@ hook.Remove(event: String, uid: String)
```gdscript
# autorun.gd
var hook: Hook = Hook.new()
@onready var hook: Hook = Hook.new()
func printHookOutput1(a: String, b: String):
print(a, " ", b)

View File

@ -21,7 +21,6 @@ void Hook::Call(String event, Array args = Array(), bool defer = false) {
}
}
for (int i = 0; i < table.size(); i++) {
Dictionary tmp = table.get(event, Dictionary());
if (!tmp.is_empty()) {
Array keys = tmp.keys();
@ -29,7 +28,8 @@ void Hook::Call(String event, Array args = Array(), bool defer = false) {
Callable function = tmp[keys[key_i]];
if (!defer) {
Callable::CallError call_error;
function.callp(argptrs, args.size(), Variant(), call_error);
Variant r_return_variant = Variant();
function.callp(argptrs, args.size(), r_return_variant, call_error);
} else {
function.call_deferredp(argptrs, args.size());
}
@ -38,7 +38,6 @@ void Hook::Call(String event, Array args = Array(), bool defer = false) {
ERR_PRINT("Hook event '" + event + "' cannot be found or empty.");
}
}
}
void Hook::Remove(String event, String uid) {
Dictionary tmp = table.get(event, Dictionary());