Fixed support for custom events in common LUA library for CC and OC

This commit is contained in:
LemADEC 2022-03-06 19:21:38 +01:00
parent 705f0bec84
commit 97aaf00db0
2 changed files with 6 additions and 6 deletions

View file

@ -855,7 +855,9 @@ end
-- returns isSupported, needRedraw
local function event_handler(eventName, param)
local needRedraw = false
if eventName == "redstone" then
if event_handlers[eventName] ~= nil then
needRedraw = event_handlers[eventName](eventName, param)
elseif eventName == "redstone" then
w.event_redstone(param)
elseif eventName == "timer" then
w.event_timer_tick(param)
@ -872,8 +874,6 @@ local function event_handler(eventName, param)
elseif eventName == "peripheral" then
elseif eventName == "peripheral_detach" then
-- not supported: task_complete, rednet_message, modem_message
elseif event_handlers[eventName] ~= nil then
needRedraw = event_handlers[eventName](eventName, param)
else
return false, needRedraw
end

View file

@ -872,7 +872,9 @@ end
-- returns isSupported, needRedraw
local function event_handler(eventName, param)
local needRedraw = false
if eventName == "redstone" then
if event_handlers[eventName] ~= nil then
needRedraw = event_handlers[eventName](eventName, param)
elseif eventName == "redstone" then
-- w.event_redstone(param)
elseif eventName == "key_up" then
elseif eventName == "touch" then
@ -891,8 +893,6 @@ local function event_handler(eventName, param)
elseif eventName == "term_unavailable" then
needRedraw = true
-- not supported: task_complete, rednet_message, modem_message
elseif event_handlers[eventName] ~= nil then
needRedraw = event_handlers[eventName](eventName, param)
else
return false, needRedraw
end