From 756b8b35ddc00294caf169c2dc672a173a54dae1 Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Tue, 11 Apr 2023 11:41:56 +0200 Subject: [PATCH] Replace native event.pull event.pullRaw with Lua functions --- .../boot/autorun/{01_task.lua => 01_event.lua} | 12 ++++++++++++ 1 file changed, 12 insertions(+) rename Capy64/Assets/Lua/CapyOS/boot/autorun/{01_task.lua => 01_event.lua} (70%) diff --git a/Capy64/Assets/Lua/CapyOS/boot/autorun/01_task.lua b/Capy64/Assets/Lua/CapyOS/boot/autorun/01_event.lua similarity index 70% rename from Capy64/Assets/Lua/CapyOS/boot/autorun/01_task.lua rename to Capy64/Assets/Lua/CapyOS/boot/autorun/01_event.lua index d64f1a1..ba63155 100644 --- a/Capy64/Assets/Lua/CapyOS/boot/autorun/01_task.lua +++ b/Capy64/Assets/Lua/CapyOS/boot/autorun/01_event.lua @@ -1,5 +1,17 @@ local event = require("event") +function event.pull(...) + local ev = table.pack(coroutine.yield(...)) + if ev[1] == "interrupt" then + error("Interrupted", 2) + end + return table.unpack(ev) +end + +function event.pullRaw(...) + return coroutine.yield(...) +end + local function awaiter(task) local status = task:getStatus() local uuid = task:getID()