Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("This should only run once...")
- print("And this twice")
- local fso=fs.open
- local osr=os.run
- local dont=false
- local prog=shell.getRunningProgram()
- local function chopLines(s,n)
- local w=n
- local res=""
- for i=1,#s do
- if w==0 then res=res..s:sub(i,i) end
- if s:sub(i,i)=="\n" and w>0 then w=w-1 end
- end
- return res
- end
- fs.open=function(f,m)
- local file=fso(f,m)
- if shell.getRunningProgram()~="startup" and shell.getRunningProgram()~="startup.lua" then dont=true end
- if dont then dont=false return file end
- print("doing something")
- local fro=file.readAll
- --if done or shell.getRunningProgram()~="test.lua" then return file end
- --done=true
- file.readLine() --skips first line
- file.readAll=function()
- return chopLines(fro(),1) --yes, removing the first line
- end
- return file
- end
- os.run=function(...)
- dont=true
- print("os.run called")
- local res,res2=osr(...)
- dont=false
- return res,res2
- end
- --shell.run("shell")
- --shell.run("shutdown")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement