Advertisement
BelgianNoise

Untitled

Apr 4th, 2020
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. posOfMonitor = "right"
  2.  
  3. file = fs.open("items/pumpjack", "r")
  4. itemname = "placeholder"
  5. steel = "0"
  6. blocks = {}
  7.  
  8. if file then
  9.     count = 0
  10.     temp = true
  11.     while (temp) do
  12.         t = file.readLine()
  13.         if (t) then
  14.             if count == 0 then
  15.                 itemname = t
  16.                 print("Itemname:  " .. t)
  17.             else if count == 1 then
  18.                 steel = t
  19.                 print("Amount Of Steel:  " .. t)
  20.             else
  21.                 blocks[count - 1] = t
  22.                 print("Added Block:  " .. t)
  23.             end
  24.             count = count + 1
  25.         else
  26.             temp = false
  27.         end
  28.     end    
  29.     file.close()
  30. else
  31.     print("File doesn't exist.")
  32.     return false
  33. end
  34.  
  35. mon = peripheral.wrap(posOfMonitor)
  36. mon.clear()
  37. mon.setTextScale(2)
  38. line = 1
  39.  
  40. mon.setCursorPos(1,line)
  41.  
  42. mon.write("======= " .. itemname .. " ============================")
  43.  
  44. for i, block in ipairs(blocks) do
  45.     mon.setCursorPos(1,line + 1)
  46.     mon.write("   - " .. block)
  47.     line = line + 1
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement