Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.run = "fail"
- os.shutdown = function()
- function os.version()
- if turtle then
- return "Custom Turtle Shell ver 0.1"
- end
- return "Custom shell ver 0.1"
- end
- os.shutdown = function()
- while true do
- coroutine.yield()
- end
- end
- os.run = function( _tEnv, _sPath, ... )
- local tArgs = { ... }
- local fnFile, err = loadfile( _sPath )
- if fnFile then
- local tEnv = _tEnv
- setmetatable( tEnv, { __index = _G } )
- setfenv( fnFile, tEnv )
- local ok, err = pcall( function()
- fnFile( unpack( tArgs ) )
- end )
- if not ok then
- if err and err ~= "" then
- print( err )
- end
- return false
- end
- return true
- end
- if err and err ~= "" then
- print( err )
- end
- return false
- end
- term.clear()
- term.setCursorPos(1,1)
- term.write("test")
- coroutine.yield()
- local ProgENV = {}
- if fs.exists("rom/programs/shell") then
- local file = fs.open("cshell", "r" )
- local fFunction = loadstring(file.readAll())
- -- local fFunction = loadstring(file.readAll(),"frandom")
- file.close()
- setmetatable( ProgENV, { __index = _G } ) -- no idear wtf this does but it works
- setfenv(fFunction,ProgENV)
- cProgram = coroutine.create(fFunction)
- end
- term.clear()
- term.setCursorPos(1,1)
- while true do
- local e,e1,e2,e3,e4,e5 = coroutine.yield()
- coroutine.resume(cProgram,e,e1,e2,e3,e4,e5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement