optimisation

This commit is contained in:
Izaya 2017-04-23 19:05:16 +10:00
parent c221f0ba8d
commit 50ca1050b1
6 changed files with 12 additions and 15 deletions

View File

@ -1,8 +1,7 @@
function nshc(evPP,nid) function nshc(evPP,nid)
while true do while true do
if ev[1] == "net_msg" then if ev[1] == "net_msg" then
local V=false local V,msg=false,tostring(ev[4])
local msg = tostring(ev[4])
if ev[3] == evPP and ev[2] == nid then if ev[3] == evPP and ev[2] == nid then
if msg:sub(1,3) == "dis" then if msg:sub(1,3) == "dis" then
h("display",msg:sub(4)) h("display",msg:sub(4))

View File

@ -1,10 +1,8 @@
evPP,tEPs=4,{} evPP,tEPs=4,{}
s("netsh daemon",function() s("netsh daemon",function()
print("netsh daemon started")
while true do while true do
if ev[1] == "net_msg" then if ev[1] == "net_msg" then
local V=false local V,msg=false,tostring(ev[4])
local msg = tostring(ev[4])
for k,v in ipairs(tEPs) do if ev[2] == v then V=true end end for k,v in ipairs(tEPs) do if ev[2] == v then V=true end end
if ev[3] == evPP and V then if ev[3] == evPP and V then
if msg:sub(1,3) == "key" then if msg:sub(1,3) == "key" then

View File

@ -1,8 +1,5 @@
while #tT > 0 do while #tT > 0 do
ev={computer.pullSignal(p)} ev={computer.pullSignal(p)}
for k,v in ipairs(ev) do
-- wl(tostring(v))
end
for k,v in ipairs(tT) do for k,v in ipairs(tT) do
_G.cT=k _G.cT=k
if C.status(v[2])~="dead" then if C.status(v[2])~="dead" then

View File

@ -0,0 +1,3 @@
for k,v in ipairs({{"rm","remove"},"exists",{"isdir","isDirectory"},"list",{"mkdir","makeDirectory"}}) do
load("function f"..v[1] or v.."(s)\nlocal d,p = fres(s)\nreturn d."..v[2] or v.."(p)\nend")()
end

View File

@ -1,6 +1,6 @@
fT = {} fT = {}
function fres(p) function fres(p)
local fid = (p:match("(%a-):") or p:match("/?(%a-)/")) local F = (p:match("(%a-):") or p:match("/?(%a-)/"))
local pt = (p:match("%a-:(.+)") or p:match("/?%a-/(.+)")) local P = (p:match("%a-:(.+)") or p:match("/?%a-/(.+)"))
if fT[fid] ~= nil then return fT[fid],pt else return false end if fT[F] ~= nil then return fT[fid],P else return false end
end end

View File

@ -1,11 +1,11 @@
hT = {["_c"]=0} hT = {["_c"]=0}
function fopen(p,m) function fopen(p,m)
local d,p = fres(p) local d,p = fres(p)
local f=d.open(p,m) local f,C=d.open(p,m),hT._c
if f then if f then
hT._c = hT._c + 1 hT._c = C + 1
hT[hT._c] = {d,f} hT[C] = {d,f}
return hT._c return C
end end
return false return false
end end