Enhance peripheral handling: implement detach handler to invalidate cached handles

This commit is contained in:
MayaTheShy
2026-03-22 01:37:22 -04:00
parent 4637275529
commit bd3159cd39

View File

@@ -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