Code: Select all
script.on_event('test-custom-input', function(event) end, nil) -- raises error
Code: Select all
script.on_event('test-custom-input', function(event) end) -- doesn't raise error
Code: Select all
script.on_event('test-custom-input', function(event) end, nil) -- raises error
Code: Select all
script.on_event('test-custom-input', function(event) end) -- doesn't raise error
Code: Select all
function register_event_handler(event, handler, event_filters)
if event_filters then
script.on_event(event, handler, event_filters)
else
script.on_event(event, handler)
end
end
This would not work in case I want to set the filter to nil for events that do support filters.
Sorry, you are right. I somehow thought omitting the nil would keep the previously set filter.