yeeeeeeeeeeeee

Yeeet OS Part 4

Mar 24th, 2025
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. print("Programming Environment")
  2. print("Commands: 'run <file>', 'save <file>', 'load <file>', 'exit'")
  3. while true do
  4.     write("> ")
  5.     local input = read()
  6.     local command, arg = string.match(input, "^(%S+)%s*(.*)$")
  7.     if command == "run" and arg then
  8.         if fs.exists(arg) then
  9.             local success, err = pcall(function() shell.run(arg) end)
  10.             if not success then
  11.                 print("Error: " .. err)
  12.             end
  13.         else
  14.             print("File not found.")
  15.         end
  16.     elseif command == "save" and arg then
  17.         write("Enter your code. Type 'end' to finish.")
  18.         local code = ""
  19.         while true do
  20.             local line = read()
  21.             if line == "end" then break end
  22.             code = code .. line .. "\n"
  23.         end
  24.         local file = fs.open(arg, "w")
  25.         file.write(code)
  26.         file.close()
  27.         print("File saved as " .. arg)
  28.     elseif command == "load" and arg then
  29.         if
Advertisement
Add Comment
Please, Sign In to add comment