Continue does not work?

Since the latest update (which rolled out just a few minutes ago), I have this line of code:

 if not Value then continue end

and this error:

 Expected '=' when parsing assignment, got 'end'

This was in a library script for graphing data, that I did not write, and never had an issue before… I think “continue” was supposed to be considered a continue statement, now seemingly not available.

Could be another that’s affecting it or is the script underlining that specific line? If needed, you could send the code so we could see if something else is causing it

Hmm, yeah oddly continue is not complained about in the Script Analysis tool, a few lines down.

The first “continue” in the following function is where I get the error message.


function GraphHandler.Render()
	-- Validate we have stuff to render
	if not GraphHandler.Frame or not GraphHandler.Data or not GraphHandler.Resolution then
		return
	end

	while Busy do wait(0.1) end
	Busy = true

	-- Clear old graph values
	YMarkers:ClearAllChildren()
	GraphingFrame:ClearAllChildren()
	KeyNames:ClearAllChildren()

	BaseZIndex = GraphHandler.Frame.ZIndex

	Background.ZIndex = BaseZIndex+1
	MarkerBG.ZIndex = BaseZIndex+2
	YMarkers.ZIndex = BaseZIndex+2
	GraphingFrame.ZIndex = BaseZIndex+2
	KeyNames.ZIndex = BaseZIndex+2

	local KeyLayout = Instance.new("UIListLayout")
	KeyLayout.FillDirection = Enum.FillDirection.Horizontal
	KeyLayout.HorizontalAlignment = Enum.HorizontalAlignment.Left
	KeyLayout.VerticalAlignment = Enum.VerticalAlignment.Center
	KeyLayout.Padding = UDim.new(0.01,0)
	KeyLayout.Parent = KeyNames

	local Max, Min = -math.huge,math.huge
	local Range

	-- Calculate our range of values

	for Key, Set in pairs(GraphHandler.Data) do
		local SetAmount = #Set

		for i=1,SetAmount, math.ceil(SetAmount/GraphHandler.Resolution) do
			local SortedChunk = {}
			for x=i,i+math.ceil(SetAmount/GraphHandler.Resolution) do
				SortedChunk[#SortedChunk+1] = Set[x]
			end
			table.sort(SortedChunk)

			local Value = SortedChunk[math.round(#SortedChunk*0.55)]
			if not Value then continue end

			-- Record for our range calc
			Min = math.min(Min, Value)
			Max = math.max(Max, Value)
		end
	end

	if GraphHandler.BaselineZero then
		Min = 0
		Max = Max * 1.75
	end

	Range = Max-Min

	-- Mark our Y axis values along the derived range

	for y=0,1,0.2 do
		local Marker = Instance.new("TextLabel")
		Marker.Name = y
		Marker.Size = UDim2.new(1,0,0.08,0)
		Marker.AnchorPoint = Vector2.new(0,0.5)
		Marker.Position = UDim2.new(0,0,0.9 - (y*0.9),0)
		Marker.Text = string.format("%.2f  ",(Min + (Range*y)))
		Marker.TextXAlignment = Enum.TextXAlignment.Right

		Marker.TextColor3 = Theme.Text
		Marker.Font = Enum.Font.SourceSans
		Marker.BackgroundTransparency = 1
		Marker.TextSize = (GraphHandler.Frame.AbsoluteSize.X*0.03)
		Marker.ZIndex = BaseZIndex+3
		Marker.Parent = YMarkers
	end

	-- Draw the graph at this range
	local KeyColors = {}
	for Key, Set in pairs(GraphHandler.Data) do
		-- Designate a color for this dataset
		KeyColors[Key] = getKeyColor(Key)

		local TextSize = GraphHandler.Frame.AbsoluteSize.Y*0.08
		local Size = TextService:GetTextSize(Key, TextSize, Enum.Font.SourceSansSemibold, KeyNames.AbsoluteSize)
		local KeyMarker = Instance.new("TextLabel")
		KeyMarker.Text = Key
		KeyMarker.TextColor3 = KeyColors[Key]
		KeyMarker.Font = Enum.Font.SourceSansSemibold
		KeyMarker.BackgroundTransparency = 1
		KeyMarker.TextSize = TextSize
		KeyMarker.Size = UDim2.new(0,Size.X+TextSize,1,0)
		KeyMarker.ZIndex = BaseZIndex+3
		KeyMarker.Parent = KeyNames

		-- Graph the set

		local SetAmount = #Set
		local LastPoint

		--print("  "..Key, Set)

		for i=1,SetAmount, math.ceil(SetAmount/GraphHandler.Resolution) do

			local SortedChunk = {}
			for x=i,i+math.ceil(SetAmount/GraphHandler.Resolution) do
				SortedChunk[#SortedChunk+1] = Set[x]
			end
			table.sort(SortedChunk)

			local Value = SortedChunk[math.round(#SortedChunk*0.55)]
			if not Value then continue end

			-- Create the point
			local Point = Instance.new("ImageLabel")
			Point.Name = Key..i
			Point.Position = UDim2.new(0.05+((i/SetAmount)*0.9),0, 0.9 - (((Value-Min)/Range)*0.9),0)
			Point.AnchorPoint = Vector2.new(0.5,0.5)
			Point.SizeConstraint = Enum.SizeConstraint.RelativeXX
			Point.Size = UDim2.new(math.clamp(0.5/GraphHandler.Resolution, 0.003,0.016),0,math.clamp(0.5/GraphHandler.Resolution, 0.003,0.016),0)

			Point.ImageColor3 = KeyColors[Key]
			Point.BorderSizePixel = 0
			Point.BackgroundTransparency = 1
			Point.Image = "rbxassetid://200182847"
			Point.ZIndex = BaseZIndex+5

			local Label = Instance.new("TextLabel")
			Label.Visible = false
			Label.Text = string.format("%.5f",Value)
			Label.BackgroundColor3 = Theme.LightBackground
			Label.TextColor3 = Theme.Text
			Label.Position = UDim2.new(1,0,0.4,0)
			Label.Font = Enum.Font.Code
			Label.TextSize = (GraphHandler.Frame.AbsoluteSize.X*0.025)
			Label.Size = UDim2.new(0,Label.TextSize * 0.6 * #Label.Text,0,Label.TextSize * 1.1)
			Label.Parent = Point
			Label.ZIndex = BaseZIndex+10

			Point.MouseEnter:Connect(function()
				Label.Visible = true
			end)
			Point.MouseLeave:Connect(function()
				Label.Visible = false
			end)

			-- Create the line
			if LastPoint then
				local Connector = Instance.new("Frame")
				Connector.Name = Key..i.."-"..i-1
				Connector.BackgroundColor3 = KeyColors[Key]
				Connector.BorderSizePixel = 0
				Connector.SizeConstraint = Enum.SizeConstraint.RelativeXX
				Connector.AnchorPoint = Vector2.new(0.5, 0.5)
				Connector.ZIndex = BaseZIndex+4

				local Size = GraphingFrame.AbsoluteSize
				local startX, startY = Point.Position.X.Scale*Size.X, Point.Position.Y.Scale*Size.Y
				local endX, endY = LastPoint.Position.X.Scale*Size.X, LastPoint.Position.Y.Scale*Size.Y

				local Distance = (Vector2.new(startX, startY) - Vector2.new(endX, endY)).Magnitude

				Connector.Size = UDim2.new(0, Distance, math.clamp(0.2/GraphHandler.Resolution, 0.002,0.0035), 0)
				Connector.Position = UDim2.new(0, (startX + endX) / 2, 0, (startY + endY) / 2)
				Connector.Rotation = math.atan2(endY - startY, endX - startX) * (180 / math.pi)

				Connector.Parent = GraphingFrame
			end

			LastPoint = Point
			Point.Parent = GraphingFrame

		end

	end

	Busy = false
end

I have in my notes for the script, its code I found at this link on the devforum, a month or so ago:

Graph Module- Easily draw graphs of your data

Boatbomber released it.

Continue appears to be working fine for me, i don’t think it’s exactly the updates problem? image

1 Like

I had no complaint before, until this update, and I reinstalled Studio. I’ve been working on a game all morning/afternoon.

Try not using continue and se if it’s truly your issue?

for Key, Set in pairs(GraphHandler.Data) do
	local SetAmount = #Set

	for i=1,SetAmount, math.ceil(SetAmount/GraphHandler.Resolution) do
		local SortedChunk = {}
		for x=i,i+math.ceil(SetAmount/GraphHandler.Resolution) do
			SortedChunk[#SortedChunk+1] = Set[x]
		end
		table.sort(SortedChunk)

		local Value = SortedChunk[math.round(#SortedChunk*0.55)]
		if Value then
			-- Record for our range calc
			Min = math.min(Min, Value)
			Max = math.max(Max, Value)
		end
	end
end

I’ll look around your code to see what else is going on

Yes definitely… infact, continue isn’t even syntax highlighted for some reason as a statement… as it is on the example above… I’m going to try reinstalling Studio , again.

If I delete “continue” for example, the error goes away…

Huh? Quite odd, I’m not sure if it’s something related to the code or just a bug. If you just use a full if statement instead ofa guard clause, does it work?

1 Like

Error gone after a reinstall. LOL thanks for your help.

2 Likes

Anytime! Glad your issue has been solved!

If you have anymore issues don’t be afraid to make another post!

1 Like