diff --git a/hook.cpp b/hook.cpp index 1d9b601..dbb9cad 100644 --- a/hook.cpp +++ b/hook.cpp @@ -6,13 +6,8 @@ Dictionary Hook::GetTable() { return table; } -void Hook::Create(String name) { - Dictionary newHook = Dictionary(); - table[name] = newHook; -} - void Hook::Add(String event, String uid, Ref function) { - Dictionary tmp = table[event]; + Dictionary tmp = table.get(event, Dictionary()); tmp[uid] = function; table[event] = tmp; } @@ -47,7 +42,6 @@ void Hook::Remove(String event, String uid) { void Hook::_bind_methods() { ClassDB::bind_method(D_METHOD("GetTable"), &Hook::GetTable); - ClassDB::bind_method(D_METHOD("Create", "name"), &Hook::Create); ClassDB::bind_method(D_METHOD("Add", "event", "uid", "function"), &Hook::Add); ClassDB::bind_method(D_METHOD("Call", "event", "args"), &Hook::Call); ClassDB::bind_method(D_METHOD("Remove", "event", "uid"), &Hook::Remove); diff --git a/hook.h b/hook.h index 89edd40..fe8ca30 100644 --- a/hook.h +++ b/hook.h @@ -19,7 +19,6 @@ protected: public: Dictionary GetTable(); - void Create(String name); void Add(String event, String uid, Ref function); void Call(String event, Array args); void Remove(String event, String uid);