From 6c86e3fe28f9bd48c98b750c916457e7bbb01d87 Mon Sep 17 00:00:00 2001 From: Kleadron <kleadron04@gmail.com> Date: Tue, 23 Feb 2021 12:33:08 -0800 Subject: [PATCH] file:seek and don't print nil stacktrace file:seek was missing for my program, and I encountered a problem where an error would have a nil stacktrace (with out of memory for example) and it would break the error message --- miniOS/miniOS.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/miniOS/miniOS.lua b/miniOS/miniOS.lua index 70f65d0..32bc707 100644 --- a/miniOS/miniOS.lua +++ b/miniOS/miniOS.lua @@ -564,6 +564,7 @@ function fs_code() end function fs.write(handle, data) return handle._proxy.write(handle._handle, data) end function fs.read(handle, length) return handle._proxy.read(handle._handle, length or math.huge) end + function fs.seek(handle, mode, position) return handle._proxy.seek(handle._handle, mode, position) end function fs.close(handle) return handle._proxy.close(handle._handle) end function fs.isDirectory(path) local drive @@ -1430,7 +1431,11 @@ local function runfile(file, ...) result = {interrupt(result[2])} return end end end - error(result[2] .. "\n" .. traceback, 3) + if traceback then + error(result[2] .. "\n" .. traceback, 3) + else + error(result[2], 3) + end end else error(reason, 3)