Module:Util/tables/size: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search
m (PhantomCaleb moved page Module:Util/Table/size to Module:Util/tbl/size without leaving a redirect)
m (PhantomCaleb moved page Module:Util/tbl/size to Module:Util/tables/size without leaving a redirect)
 
(No difference)

Latest revision as of 17:37, 5 May 2024

size(tbl)

Returns

  • Total number of keys in tbl.

Examples

#InputOutputResult
1
size({1, 2, foo = "bar"})
3
Green check.svg

local function size(tbl)
	local count = 0
	for k in pairs(tbl) do
		count = count + 1
	end
	return count
end

return size