Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. local rs = require("component").redstone
  2. local sides = require("sides")
  3. local event = require("event")
  4. local addr = 0
  5.  
  6. addrSide = sides.north
  7. rdSide = sides.east
  8. wrSide = sides.south
  9.  
  10. local ram = {}
  11. for i = 0, 255 do
  12.   ram[i] = 0
  13.   -- print(ram[i])
  14. end
  15.  
  16. local function redstoneUpdate(_, _, side)
  17.   if side == addrSide then
  18.     local input = rs.getBundledInput(addrSide)
  19.     local total = 0
  20.     for i = 0, 15 do
  21.       if input[i] > 0 then
  22.         input[i] = 1
  23.       end
  24.       io.write(input[i])
  25.       total = total + (input[i] * (2^i))
  26.     end
  27.     addr = total
  28.   end
  29. end
  30.  
  31. while true do
  32.   redstoneUpdate(event.pull("redstone_changed"))
  33. end
  34. -- event.listen("redstone_changed", redstoneUpdate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement