From 7535506671171bfdd4993dfab9a5305bc978f464 Mon Sep 17 00:00:00 2001 From: plague006 Date: Sun, 3 Mar 2019 15:00:35 -0500 Subject: [PATCH] Make it fancy --- utils/event.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/event.lua b/utils/event.lua index 751fd54f..5ab5b8c7 100644 --- a/utils/event.lua +++ b/utils/event.lua @@ -419,13 +419,14 @@ end function Event.generate_event_name(name) local event_id = generate_event_name() - -- If we're in debug, we add the event to defines.events in order to list it via the debugger. - if _DEBUG then - defines.events[name] = event_id -- luacheck: ignore 122 - end + defines.events[name] = event_id -- luacheck: ignore 122 return event_id end +-- If we're not in debug, we just turn the above function into an alias of script.generate_event_name +if not _DEBUG then + Event.generate_event_name = generate_event_name +end local function add_handlers() for event_name, tokens in pairs(token_handlers) do