function Database._Parse_R(u,q,h,S)S=S and S or 0 local Y={}if S>0 then Y={id=S+1}u[q.name]=Y end local p=q:GetAttributes()for u,q in pairs(p)do Y[u]=q end for q,h in ipairs(q:GetChildren())do if h.ClassName=="\070\111\108\100\101\114"then S=S+1 Database._Parse_R(u,h,Y,S)else Y[h.name]=h end end end return Database
-- Recusively parses folders only and makes a table tree.
---@param rootFolder instance
---@param data table
function Database._Parse_R(dataRoot, rootFolder, data, _id)
	_id = _id and _id or 0
	local initialTable = {}

	-- Ignore the first folder which is our root
	if _id > 0 then
		initialTable = { ["id"] = _id + 1 }
		dataRoot[rootFolder.name] = initialTable -- Store by Name
	end

	-- Store attributes
	local attributes = rootFolder:GetAttributes()
	for name, value in pairs(attributes) do
		initialTable[name] = value
	end

	-- Recursively parse every child that is a folder
	for _, child in ipairs(rootFolder:GetChildren()) do
		-- Recursively parse the folders only
		if child.ClassName == "Folder" then
			_id = _id + 1
			Database._Parse_R(dataRoot, child, initialTable, _id)
		else
			-- If it's not a folder then store it as a reference
			initialTable[child.name] = child
		end
	end
end

return Database
