Module:Utils

Documentation for this module may be created at Module:Utils/doc

local p = {}

function p.concat(t, separator)
	local str = ""
	separator = separator and separator or ", "
	local length = -1 - #separator
	
	if t ~= nil then
		for k, v in ipairs(t) do
			str = str .. v .. separator
		end
		str = str:sub(1, length)
	end
	
	return str
end

function p.length(t)
	local str = 0
	
	if t ~= nil then
		for k, v in pairs(t) do
			str = str + 1
		end
	end
	
	return str
end

function p.find(t, property, value)
	if t ~= nil then
		for k, v in pairs(t) do
			if v[property] == value then
				return t[k]
			end
		end
	end
	
	return nil
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.