File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1171,6 +1171,10 @@ os.sleep = function(timeout)
11711171 until computer .uptime () >= deadline
11721172end
11731173
1174+ os .exit = function (code )
1175+ error ({[1 ]= " INTERRUPT" , [2 ]= " EXIT" , [3 ]= code })
1176+ end
1177+
11741178-- set up terminal
11751179if term .isAvailable () then
11761180 component .gpu .bind (component .screen .address )
@@ -1195,7 +1199,8 @@ miniOS = {}
11951199local function interrupt (data )
11961200 -- print("INTERRUPT!")
11971201 if data [2 ] == " RUN" then return miniOS .runfile (data [3 ], table.unpack (data [4 ])) end
1198- if data [3 ] == " ERR" then error (" This error is for testing!" ) end
1202+ if data [2 ] == " ERR" then error (" This error is for testing!" ) end
1203+ if data [2 ] == " EXIT" then return data [3 ] end
11991204end
12001205local function runfile (file , ...)
12011206 local program , reason = loadfile (file )
You can’t perform that action at this time.
0 commit comments