Suppenbiatch

Config Creator

Oct 12th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. local name = "laserconfig"
  2. local adaptername = "laser_amplifier"
  3.  
  4. local component = require("component");
  5. local filesystem = require("filesystem");
  6. local serial = require("serialization");
  7. local term = require("term");
  8.  
  9. local gpu = component.gpu
  10. gpu.setResolution(114,42)
  11. local w, h = gpu.getResolution();
  12. gpu.setForeground(0xC8DC46)
  13. gpu.setBackground(0x252525)
  14. gpu.fill(1, 1, w, h, " ");
  15. term.setCursorBlink(false);
  16.  
  17. function fwrite(text)
  18.         local file = io.open("/home/"..name.."/config","a")
  19.         file:write(serial.serialize(text).."\n")
  20.         file:close()
  21. end
  22.  
  23. filesystem.remove("/home/"..name.."/")
  24. filesystem.makeDirectory("/home/"..name.."/")
  25.  
  26.  
  27. for address, type in component.list(adaptername) do
  28.     print("Which number is this address: ".. address)
  29.     local i = tonumber(io.read())
  30.     fwrite(";"..i..";"..address)
  31. end
  32. os.exit()
  33. adaptername = "flux_gate"
  34. for address, type in component.list(adaptername) do
  35.     fwrite(address)
  36. end
Add Comment
Please, Sign In to add comment