Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sleep(10)
- modem = peripheral.find("modem")
- tank = peripheral.wrap("back")
- capacity = tank.getFilledPercentage()*100
- formattedCapacity = string.format("%.2f", capacity)
- --Extracting Information from table--
- --for key, value in pairs(tank.getStored()) do
- -- if key == "name" or type(value) == "number" then
- -- print(key .. ":" ,, tostring(value))
- -- end
- --end
- -------------------------------------
- --Formatting the names----
- --while true do
- --for key, value in pairs(tank.getStored()) do
- --if key == "name" or type(value) == "number" then
- -- if type(value) == "string" and value:find(":") then
- -- local name = string.match(value,"([^:]+)$")
- -- local formattedName = string.gsub(name, "(%w)(%w*)",function(firstLetter,rest)
- -- return string.upper(firstLetter) .. string.lower(rest) end)
- -- print(key .. ":" .. formattedName)
- -- else
- -- print(key .. ":" .. tostring(value))
- -- end
- -- end
- -- end
- modem.open(1)
- while true do
- modem.transmit(1, 1, formattedCapacity)
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement