How to get the amount of keys in a object

local module = {
	DevItems = {
		["Item1"] = {
			["Owns"] = false;
			["Key"] = 1
		};
		["Item2"] = {
			["Owns"] = false;
			["Key"] = 2
		}
	}
}

module.__index = module
local mt = setmetatable({}, module)
return mt

How can I make it so I can get the amount of objects in DevItems, which should be 2. To add on how can I get those keys from there

You have to count them by iterating through them.

local function getKeys(x)
    local keys = {}
    for key,value in pairs(x) do
        keys[#keys + 1] = key
    end
    return keys
end

print(#getKeys(module.DevItems))