Advertisement
BelgianNoise

Untitled

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