Diff

util/helpers.lua @ 7720:7166750fb963

util.helpers: List event priorities instead of useless array index
author Kim Alvefur <zash@zash.se>
date Fri, 18 Nov 2016 10:19:34 +0100
parent 6783:cd44427c7295
child 8411:a9e8523a5e73
line wrap: on
line diff
--- a/util/helpers.lua	Thu Nov 17 22:38:46 2016 +0100
+++ b/util/helpers.lua	Fri Nov 18 10:19:34 2016 +0100
@@ -43,14 +43,14 @@
 	local event_handlers = events._handlers;
 	local events_array = {};
 	local event_handler_arrays = {};
-	for event in pairs(events._event_map) do
+	for event, priorities in pairs(events._event_map) do
 		local handlers = event_handlers[event];
 		if handlers and (event == specific_event or not specific_event) then
 			table.insert(events_array, event);
 			local handler_strings = {};
 			for i, handler in ipairs(handlers) do
 				local upvals = debug.string_from_var_table(debug.get_upvalues_table(handler));
-				handler_strings[i] = "  "..i..": "..tostring(handler)..(upvals and ("\n        "..upvals) or "");
+				handler_strings[i] = "  "..priorities[handler]..": "..tostring(handler)..(upvals and ("\n        "..upvals) or "");
 			end
 			event_handler_arrays[event] = handler_strings;
 		end