Advertisement
Guest User

set_bind.lua

a guest
Feb 10th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. --[[ Keyboard and Screen Binder
  2.  
  3.  This tool should only be run on a computer that currently has the correct
  4.  keyboard and screen assigned to it.
  5.  
  6.  Best practice is to set up your computer and run this before connecting a
  7.  cable to the rest of your OC network.
  8.  
  9.   ]]
  10.  
  11. local component = require("component")
  12. output = io.open("/etc/rc.d/bind_perphs.lua", "w")
  13.  
  14. output:write("function start(config)\n")
  15. output:write("  local component = require(\"component\")\n\n")
  16.  
  17. output:write("  component.setPrimary(\"keyboard\", \"")
  18. output:write((component.getPrimary("keyboard").address))
  19. output:write("\")\n")
  20.  
  21. output:write("  component.gpu.bind(\"")
  22. output:write((component.getPrimary("screen").address))
  23. output:write("\")\n\n")
  24.  
  25. output:write("end")
  26.  
  27. output:close()
  28.  
  29. os.execute("rc bind_perphs enable")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement