Comparison

util/helpers.lua @ 7723:488fddf88ffd

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 19 Nov 2016 01:05:36 +0100
parent 7720:7166750fb963
child 8411:a9e8523a5e73
comparison
equal deleted inserted replaced
7719:17c7e3ac47f7 7723:488fddf88ffd
41 41
42 local function show_events(events, specific_event) 42 local function show_events(events, specific_event)
43 local event_handlers = events._handlers; 43 local event_handlers = events._handlers;
44 local events_array = {}; 44 local events_array = {};
45 local event_handler_arrays = {}; 45 local event_handler_arrays = {};
46 for event in pairs(events._event_map) do 46 for event, priorities in pairs(events._event_map) do
47 local handlers = event_handlers[event]; 47 local handlers = event_handlers[event];
48 if handlers and (event == specific_event or not specific_event) then 48 if handlers and (event == specific_event or not specific_event) then
49 table.insert(events_array, event); 49 table.insert(events_array, event);
50 local handler_strings = {}; 50 local handler_strings = {};
51 for i, handler in ipairs(handlers) do 51 for i, handler in ipairs(handlers) do
52 local upvals = debug.string_from_var_table(debug.get_upvalues_table(handler)); 52 local upvals = debug.string_from_var_table(debug.get_upvalues_table(handler));
53 handler_strings[i] = " "..i..": "..tostring(handler)..(upvals and ("\n "..upvals) or ""); 53 handler_strings[i] = " "..priorities[handler]..": "..tostring(handler)..(upvals and ("\n "..upvals) or "");
54 end 54 end
55 event_handler_arrays[event] = handler_strings; 55 event_handler_arrays[event] = handler_strings;
56 end 56 end
57 end 57 end
58 table.sort(events_array); 58 table.sort(events_array);