From 593f6c40c05a344f388196b9d96ead7217c154bb Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Tue, 1 Aug 2017 23:59:29 +1000 Subject: [PATCH] a bunch of random bugfixes --- genkernel.sh | 1 + modules/applications/skex2.lua | 12 +++++++----- modules/base/header.lua | 2 +- modules/lib/print.lua | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/genkernel.sh b/genkernel.sh index 3472a18..eb9dde6 100755 --- a/genkernel.sh +++ b/genkernel.sh @@ -1,2 +1,3 @@ #!/bin/bash ./genkernel.lua build.cfg "$(git rev-parse --short HEAD)" > kernel.lua +lua strip.lua kernel.lua skernel.lua diff --git a/modules/applications/skex2.lua b/modules/applications/skex2.lua index 45bff16..4cf2c1b 100644 --- a/modules/applications/skex2.lua +++ b/modules/applications/skex2.lua @@ -4,10 +4,12 @@ function skex2(fp) if not fp then return end if not rp then ft = {} end local f=io.open(fp,"rb") - C=f:read("*a") - f:close() - for l in C:gmatch("[^\n]+") do - ft[#ft+1] = l + if f then + C=f:read("*a") + f:close() + for l in C:gmatch("[^\n]+") do + ft[#ft+1] = l + end end end function ct.writefile(nfp) @@ -30,7 +32,7 @@ function skex2(fp) end end function ct.sp(np) - if np then p=tonumber(np)%#ft end + if np then p=(tonumber(np)%#ft)+1 end end function ct.pointer(np) ct.sp(np) diff --git a/modules/base/header.lua b/modules/base/header.lua index d4cfab4..4ab148d 100644 --- a/modules/base/header.lua +++ b/modules/base/header.lua @@ -9,7 +9,7 @@ do -- so local works -- ["ep"]= event queue pointer -- } local tT,nP,rg,eq,p = {},1,_G,{},1 -- taskTable,nextPid,real _G,event queue - _G.cT,sbt,C,T = 0,{},coroutine,table -- currentTask,sandboxTable + _G.cT,sbt,C,T,io = 0,{},coroutine,table,io -- currentTask,sandboxTable function _G.spawn(n,f,e) tT[nP] = {} sbt[nP] = {} diff --git a/modules/lib/print.lua b/modules/lib/print.lua index 886adaa..a458694 100644 --- a/modules/lib/print.lua +++ b/modules/lib/print.lua @@ -8,3 +8,4 @@ function print(...) write(tostring(v).."\n") end end +io.write = write