Weird Error

I’m getting this error and it’s not making any sense. I went through all of the code pretty thoroughly and I didn’t see anything wrong. Here’s the error I’m getting and the code near that area:


[ERROR] lua/autorun/reports.lua:661: bad key to string index (number expected, got string)
  1. error - [C]:-1
   2. __index - lua/includes/extensions/string.lua:274
    3. unknown - lua/autorun/reports.lua:661


Lines 655-668


		local title = vgui.Create("DLabel", main)
		title:SetPos((main:GetWide() * .5) - 35, 40)
		title:SetText("")
		title.Paint = function()
			surface.SetTextColor(0, 255, 0, 255)
			surface.SetFont("ReportTitles")
			surface.SetTextPos(((title:GetWide() * .5) * .7), (title:GetTall() * .5) * .67)
			surface.DrawText("Title")
		end
	
		titleBox = vgui.Create("DTextEntry", main)
		titleBox:SetPos(4, 70)
		titleBox:SetText("")
		titleBox:SetSize(main:GetWide() - 8, 20)

[lua]surface.SetTextPos(((title:GetWide() * .5) * .7), (title:GetTall() * .5) * .67)[/lua]
Note that the order of multiplication will not alter the product

[lua]surface.SetTextPos(title:GetWide() * .35, title:GetTall() * .335)[/lua]

Can you indicate line 661?

EDIT: I still don’t notice the issue, but you can also remove some extra parenthesis. You don’t need parenthesis around multiplication if you’re following with subtraction. Use order of operations to cut out some of that extra stuff. just helps keep it easy to look at.


			surface.SetTextPos(((title:GetWide() * .5) * .7), (title:GetTall() * .5) * .67)

Thanks for the tip, I’ll change the multiplication.

EDIT: And addition/subtraction :slight_smile: