Advertisement
Guest User

startup.lua

a guest
Jul 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local shatter = require("/programs/apis/shatter") -- Load the shatter API
  2. local mods = peripheral.wrap("back") -- get the modules list
  3. if not mods.canvas then -- ensure glasses are present
  4.   error("Overlay Glasses required") -- error if they aren't there
  5. end
  6. term.clear()
  7. print("Outputting to Overlay Glasses")
  8. mods.canvas().clear() -- make sure glasses are cleared
  9. _G.glasses, handler = shatter(mods.canvas()) -- get the terminal object, and put it in the global scope (for alpha setting [and more!] in the shell)
  10.  
  11. parallel.waitForAll(handler, -- put the handler function in parallel
  12. function()
  13.   term.redirect(glasses) -- redirect to overlay
  14.   glasses.setBackgroundAlpha(0.2) -- set the alpha value of the background to .4, for visibility.
  15.   term.clear() -- apply the alpha value change
  16.   shell.run(--[[{},]] "/programs/.shatterstartup/multishell.lua") -- run multishell
  17. end,
  18. function()
  19.   while true do
  20.     os.pullEvent("shatter_resize") -- check for when the glasses get resized
  21.     os.queueEvent("term_resize") -- apply it to the shell terminal
  22.   end
  23. end
  24. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement