Compare commits

..

No commits in common. "18a42c61d30107507cc37e575079ff6e5f787e53" and "f336f48bbfae802b38873e37ac63bcb0c0ccd418" have entirely different histories.

2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ Example compilation `Windows` command: `scons p=windows tools=yes -j4`
```gdscript
hook.GetTable()
hook.Add(event: String, uid: String, function: Callable)
hook.Call(event: String, args: Array = [], defer: bool = false)
hook.Call(event: String, args: Array, defer: bool = false)
hook.Remove(event: String, uid: String)
```

View File

@ -12,7 +12,7 @@ void Hook::Add(String event, String uid, Callable function) {
table[event] = tmp;
}
void Hook::Call(String event, Array args = Array(), bool defer = false) {
void Hook::Call(String event, Array args, bool defer = false) {
const Variant **argptrs = nullptr;
if (args.size() > 0) {
argptrs = (const Variant **)alloca(sizeof(Variant *) * args.size());
@ -56,7 +56,7 @@ void Hook::Remove(String event, String uid) {
void Hook::_bind_methods() {
ClassDB::bind_method(D_METHOD("GetTable"), &Hook::GetTable);
ClassDB::bind_method(D_METHOD("Add", "event", "uid", "function"), &Hook::Add);
ClassDB::bind_method(D_METHOD("Call", "event", "args", "defer"), &Hook::Call, DEFVAL(Array()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("Call", "event", "args", "defer"), &Hook::Call, DEFVAL(false));
ClassDB::bind_method(D_METHOD("Remove", "event", "uid"), &Hook::Remove);
};