mirror of
https://github.com/Mestima/GodotHook.git
synced 2025-05-03 14:50:27 +00:00
args parameter is optional now
This commit is contained in:
parent
f336f48bbf
commit
8f42c858ea
4
hook.cpp
4
hook.cpp
@ -12,7 +12,7 @@ void Hook::Add(String event, String uid, Callable function) {
|
||||
table[event] = tmp;
|
||||
}
|
||||
|
||||
void Hook::Call(String event, Array args, bool defer = false) {
|
||||
void Hook::Call(String event, Array args = Array(), 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(false));
|
||||
ClassDB::bind_method(D_METHOD("Call", "event", "args", "defer"), &Hook::Call, DEFVAL(Array()), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("Remove", "event", "uid"), &Hook::Remove);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user