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

[FIXED] = expected when = is already there?

Started by DaJelloKing, 04 April 2013 - 01:40 PM
DaJelloKing #1
Posted 04 April 2013 - 03:40 PM
Alright, so im following the tutorial on making an OS for an advanced computer to learn a few things, and ive hit a snag.
Im getting an error " bios:338: [string "gui"]:20: '=' expected ".
this problem is coming up when useing the paintutils api "bground = paintutils.loadImage(.background)"

here is the code (btw im using ccemu)


--Desktop

slc = 0
tBarC = 8
tBartC = 1
backColor = 1
term.setBackgroundColor(backColor)
term.clear()
function titleBar()
  term.setCursorPos(1,1)
  term.setBackgroundColor(tBarC)
  term.setTextColor(tBartC)
  term.clearLine()
  term.setCursorPos(3, 1)
  print("[Begin]")
end
function drawDesktop()
  term.setBackgroundColor(backColor)
  term.clear
  bground = paintutils.loadImage(.background)
  paintutils.drawImage(bground, 1, 1)
  titleBar()

end

drawDesktop()
while true do
local event, button, X, Y = os.pullEventRaw()
  if slc == 0 then
	if event == "mouse_click" then
	  if X >=2 and X <=8 and y==1 and button ==1 then
	  term.clear()

		else
		drawDesktop()
	  end

	end

  end

end




thats it. I have tried to fix this for a fortnight and im stumped, so all help will be greatly appreciated.
Thanks!
Kingdaro #2
Posted 04 April 2013 - 04:04 PM
You're missing parentheses on the "term.clear" line before that. The reason it says "= expected" is because it's expecting you to do something like this:


term.clear
= someValue

Lua looks for variable assignments before function calls.

Also, you should have quotes around .background on that line as well.

  bground = paintutils.loadImage(".background")
DaJelloKing #3
Posted 05 April 2013 - 02:37 AM
You're missing parentheses on the "term.clear" line before that. The reason it says "= expected" is because it's expecting you to do something like this:


term.clear
= someValue

Lua looks for variable assignments before function calls.

Also, you should have quotes around .background on that line as well.

  bground = paintutils.loadImage(".background")
Thanks! I cant believe in over two weeks, and close to 100 look overs I didnt see that, noob mistake.
and the reason the quotation marks where off .background is because I was trying everything I could think of to fix this.
once again thanks!