Advertisement
Guest User

Terminal MineOS OpenComputers

a guest
Jan 22nd, 2020
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. local buffer = require("doubleBuffering")
  2. local GUI = require("GUI")
  3. local MineOSInterface = require("MineOSInterface")
  4. local process = require("process")
  5.  
  6. local mainContainer, window = MineOSInterface.addWindow(MineOSInterface.filledWindow(1, 1, 88, 25, 0x262626))
  7. local panel
  8. local env
  9. ------------------------------
  10. function shallowcopy(orig)
  11.     local orig_type = type(orig)
  12.     local copy
  13.     if orig_type == 'table' then
  14.         copy = {}
  15.         for orig_key, orig_value in pairs(orig) do
  16.             copy[orig_key] = orig_value
  17.         end
  18.     else
  19.         copy = orig
  20.     end
  21.     return copy
  22. end
  23.  
  24. -------------------------
  25. function new()
  26. end
  27.  
  28. function virtualScreen()
  29.  local T1 = shallowcopy(process.info().env)
  30.  
  31.     local functions={
  32.         require = function (str)
  33.             local o = require(str)      
  34.             GUI.error(str)
  35.             return o      
  36.         end,
  37.         print = function(str)
  38.             GUI.error(str)
  39.         end
  40.     }
  41.     T1.print = functions.print
  42.     T1.require = functions.require
  43.     --GUI.error(T1.require)
  44.     return T1
  45. end
  46.  
  47. function init()
  48.     panel = GUI.panel(1, 1+3, window.width, window.height, 0x000000)
  49.     window:addChild(panel)
  50.     env = virtualScreen()
  51.     local sh1 =process.load("sh",env)
  52.     coroutine.resume(sh1)
  53. end
  54. function display()
  55.     window:draw()
  56.     buffer.draw(true)
  57. end
  58.  
  59. function main()
  60.     init()
  61.     display()
  62. end
  63.  
  64.  
  65. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement