Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Programming Environment")
- print("Commands: 'run <file>', 'save <file>', 'load <file>', 'exit'")
- while true do
- write("> ")
- local input = read()
- local command, arg = string.match(input, "^(%S+)%s*(.*)$")
- if command == "run" and arg then
- if fs.exists(arg) then
- local success, err = pcall(function() shell.run(arg) end)
- if not success then
- print("Error: " .. err)
- local log = fs.open("/error_log.txt", "a")
- log.writeLine("Error while running " .. arg .. ": " .. err)
- log.close()
- end
- else
- print("File not found.")
- end
- elseif command == "save" and arg then
- write("Enter your code. Type 'end' to finish.")
- local code = ""
- while true do
- local line = read()
- if line == "end" then break end
- code = code .. line .. "\n"
- end
- local file = fs.open(arg, "w")
- file.write(code)
- file.close()
- print("File saved as " .. arg)
- elseif command == "load" and arg then
- if fs.exists(arg) then
- local file = fs.open(arg, "r")
- print(file.readAll())
- file.close()
- else
- print("File not found.")
- end
- elseif command == "exit" then
- break
- else
- print("Invalid command.")
- end
- end
Advertisement
Comments
-
- https://upfiles.com/XKUzY
- https://upfiles.com/DZ0R4GPq
- https://upfiles.com/pdC7LJ
- https://upfiles.com/AHjK6cF
- https://upfiles.com/SYa5z9oB
- https://upfiles.com/Nq50ub
- https://upfiles.com/09KH
- https://upfiles.com/JOB5A8
- https://upfiles.com/5awI
- https://upfiles.com/7iX84aQA
- https://upfiles.com/8w3F
- https://upfiles.com/n8Aj
- https://upfiles.com/lRwHx
- https://upfiles.com/fRdZ
- https://upfiles.com/w4Fn
- https://upfiles.com/tBj5
- https://upfiles.com/LSayX
- https://upfiles.com/D1ICtLyq
- https://upfiles.com/U5kq
- https://upfiles.com/OOKTpYO
- https://upfiles.com/1OANvd
- https://upfiles.com/4lYCJJ3v
- https://upfiles.com/icYwoqQZ
- https://upfiles.com/hDAEwOV
- https://upfiles.com/PG8cyJ
- https://upfiles.com/mrEqGsT5
- https://upfiles.com/pFdorL
- https://upfiles.com/EKoZ
- https://upfiles.com/wclBkBb
-
- https://bigwarp.io/7txvvw88j47z
- https://bigwarp.io/37cal9qxtkfd
- https://bigwarp.io/yojwi7en1pvq
- https://bigwarp.io/qijd9p456n3q
- https://bigwarp.io/8q8rweiy8jbr
- https://bigwarp.io/twu7014koab0
- https://bigwarp.io/a52gx3me2yb6
- https://bigwarp.io/vbg8tr63zpg7
- https://bigwarp.io/0buj2xybbiya
- https://bigwarp.io/bpkjblxxvcne
- https://bigwarp.io/2uybz9tn4ylx
- https://bigwarp.io/zgj5po6pvxzi
- https://bigwarp.io/mku1zg635c3p
- https://bigwarp.io/ehrx7oehy8dz
- https://bigwarp.io/sgrz07aqfp65
- https://bigwarp.io/xrhv7lzwf1lg
- https://bigwarp.io/lng31yy8nn5t
- https://bigwarp.io/1m2pzph656py
- https://bigwarp.io/qigrntkn99pb
- https://bigwarp.io/8zndb2n6jiwy
- https://bigwarp.io/8ekzkk952yu3
- https://bigwarp.io/1u99fslfyel0
- https://bigwarp.io/n6cq48ytrt2i
- https://bigwarp.io/u1id0cxubkyb
- https://bigwarp.io/256mpeyeztk7
- https://bigwarp.io/4tj0wc77cwa6
- https://bigwarp.io/smia0be9sl37
- https://bigwarp.io/4ewhxoikf7h5
- https://bigwarp.io/2in30egwonhl
- https://bigwarp.io/tqy9xpjngixh
- https://bigwarp.io/h9xehnci6u8h
- https://bigwarp.io/qwpzfxbpgu4g
- https://bigwarp.io/l3cf70paqezn
- https://bigwarp.io/d0t4fi81l11u
- https://bigwarp.io/0gzjnnvnrtu3
- https://bigwarp.io/aak8g4hw082r
- https://bigwarp.io/if31zbaew096
- https://bigwarp.io/afpl9j47wc3p
- https://bigwarp.io/fphgzk153qxu
- https://bigwarp.io/c16cno5bjc4e
- https://bigwarp.io/x6xtle3ba6u0
- https://bigwarp.io/aav4uxfa6vy4
- https://bigwarp.io/rxzo4cgcquty
- https://bigwarp.io/tga6z9h6iblh
- https://bigwarp.io/mux73oomlrk4
- https://bigwarp.io/ojso2y0iiqla
- https://bigwarp.io/r2x3ww3buw4q
- https://bigwarp.io/43a823em4m6g
Add Comment
Please, Sign In to add comment
Advertisement