How would i compare 2 audio's rms levels and give it a fair number score?

how would i go about comparing two audios and giving it a number score based off the rms level of it? i have tried to save these values to a table and then add all of them up and check what number comes out but its always inaccurate. here is the thing i use:

-- data.a1 and data.a2 are tables lol
        local a1v = 0
		local a2v = 0
		for _, v1 in data.a1 do
			a1v = a1v + v1
		end
		for _, v2 in data.a2 do
			a2v = a2v + v2 / 1000
		end
		print(a1v)
		print(a2v)

any guidance or help is really appreciated!! ;3