Enhance peripheral handling: implement detach handler to invalidate cached handles
This commit is contained in:
@@ -3351,7 +3351,19 @@ local function main()
|
||||
end
|
||||
end,
|
||||
|
||||
-- Task 11: Network order/command listener
|
||||
-- Task 11: Peripheral detach handler (invalidates cached handles)
|
||||
function()
|
||||
while true do
|
||||
local event, name = os.pullEvent("peripheral_detach")
|
||||
if name then
|
||||
invalidateWrapCache(name)
|
||||
invalidatePeripheralCaches()
|
||||
print("[DETACH] " .. name)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
-- Task 12: Network order/command listener
|
||||
function()
|
||||
if not networkModem then return end
|
||||
while true do
|
||||
|
||||
Reference in New Issue
Block a user