This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dustmuz's profile picture

missing = in while true do?

Started by Dustmuz, 20 September 2015 - 11:48 AM
Dustmuz #1
Posted 20 September 2015 - 01:48 PM
this code throws this error - bios14: [string "startup"]:8: '=' expected



local mon = peripheral.wrap("monitor_0")
local tank = peripheral.wrap("rcsteeltankvalvetile_0")

local infoTank = tank.getTankInfo()
local tankContent = infoTank[1].contents.rawName
local tankAmount = infoTank[1]contents.amount

while true do
  mon.clear()
  mon.setCursorPos(1,1)
  mon.write("Steel Tank 1: "..tankAmount.." "..tankContent)
  sleep(2)
end


is it just me that is in need of new glasses, or what did i do wrong??
Wojbie #2
Posted 20 September 2015 - 01:55 PM
You are missing dot in line 6.

It is:


local tankAmount = infoTank[1]contents.amount

and it should be


local tankAmount = infoTank[1].contents.amount
Edited on 20 September 2015 - 11:56 AM
Dustmuz #3
Posted 20 September 2015 - 04:12 PM
okay thanks :D/> i need new glasses :D/> hehe

Thanks a lot :)/>