add file io error printing

This commit is contained in:
Redo 2022-11-01 14:43:25 -06:00
parent ae6dd9f2bc
commit c162f1c98c

View File

@ -159,7 +159,8 @@ local function assembleCode(code, instrs)
end
local function readFile(fn)
local fi = io.open(fn, "r") or error("could not open file "..fn)
local fi, err = io.open(fn, "r")
if not fi then error("could not open file "..fn..": "..err) end
local text = fi:read("*a")
fi:close()
return text