Code crashing studio when not even running

Adding any character into the n1.connect() as parameter crashes studio. Note: nothing is running. Why is it doing that?

8e1b774f03c11c67fb2b38c7f1cb2c7e

Here’s the code

local Node = {}

Node.new = function()
	local self = {}
	
	local adjacencies = {}
	
	function self.connect(node, recurse : boolean)
		if not table.find(adjacencies,node) then
			table.insert(adjacencies, node)
			if not recurse then
				node.connect(self,true)
			end
		end
	end
	function self.disconnect(node, recurse : boolean)
		local index = table.find(adjacencies, node)
		if index then
			table.remove(adjacencies,index)
			if not recurse then
				node.disconnect(self,true)
			end
		end
	end
	function self.getAdjacencies()
		return adjacencies
	end
	
	return self
end

local n1 = Node.new()
local n2 = Node.new()

n1.connect()

Could be the generative ai trying to many possibilities?

Disabling generative AI did not fix it. I assume it has to do with intellisense.

This seems more like a studio bug than something wrong with your code

I feel the same way. Please try it yourself, let me know if you get the same result (just put the code into a module, and then try to connect n1 to n2)

I tried it and got the exact same crash

how you tried debugging? It’s seems that your function is recursive (means it calls it self) and it’s acting like a while loop, because you do first check if not node in the table then insert it, but the node argument is nil, so it never will be finded/inserted. Then you check if it’s not recursive then call function connect in the node, but you give no arguments to this function! Is it happends when you running this code without calling connect function?

I give no arguments in the code, because when I add the arguments studio crashes. This isn’t about running the code… this is about typing it.

Try to find backdoors in your game probably can be It If not try to use a task wait in Start

This is literally on a brand new place, though.

respectfully, do not comment unless you know what you are saying…

this is a code editor bug.

1 Like