Clear hooks on lua shutdown

This commit is contained in:
MysterD 2022-05-09 09:53:14 -07:00
parent 26cc9ee17f
commit d7bf47c5de
3 changed files with 3 additions and 1 deletions

View file

@ -183,6 +183,7 @@ void smlua_shutdown(void) {
audio_custom_shutdown();
smlua_cobject_allowlist_shutdown();
smlua_cpointer_allowlist_shutdown();
smlua_clear_hooks();
lua_State* L = gLuaState;
if (L != NULL) {
lua_close(L);

View file

@ -977,7 +977,7 @@ int smlua_hook_on_sync_table_change(lua_State* L) {
// misc //
//////////
static void smlua_clear_hooks(void) {
void smlua_clear_hooks(void) {
for (int i = 0; i < HOOK_MAX; i++) {
struct LuaHookedEvent* hooked = &sHookedEvents[i];
for (int j = 0; j < hooked->count; j++) {

View file

@ -88,6 +88,7 @@ u32 smlua_get_action_interaction_type(struct MarioState* m);
bool smlua_call_chat_command_hook(char* command);
void smlua_display_chat_commands(void);
void smlua_clear_hooks(void);
void smlua_bind_hooks(void);
#endif