Check if a Key Exists in a Nested Table?

Hey there! Just need some help with a small issue. I’m trying to compare two tables, but one of them is nested within another. I tried using various methods to check if the key existed but none of them seemed to work. If you’re able to assist me in anyway, it’d help a lot.

(mb Accidentally posted early)

1 Like
local function pairsrecursive(t, k)
	for i, v in pairs(t) do
		if i == k then
			return true
		if type(v) == "table" then

t would be a table and k the key you’re searching for.

The function will return true if the key was found, otherwise it’ll return nil.