AllAreType

This function is designed to make long If statements quicker and easier. Allows you to check lots of values at once for the same type

&lt;PREFIX&gt;_allAreType(type, param [,param [, ...]])

Note:
 * If just the type parameter is given then the function returns true, as no parameters have failed the check (See example 'c' below).

Arguments

 * type: String - A string that represents the desired type of the values. See type for further help on this value.
 * param: any - A list of values to check for the same, consistent type.

Returns

 * result: Boolean - true if all of the params have the desired type, false if atleast one fails.

Example
local a = _allAreType("string", "Hello", DEFAULT_CHAT_FRAME:GetName) local b = _allAreType("number", 65, tonumber("two")) local c = _allAreType("table", {}, {5, 3, "Hello"}, "Bob")

-- edge cases local d = _allAreType("function") local e = _allAreType("function", nil)

Result
a = true b = false c = false

-- edge cases d = true e = false

Code
function _allAreType(typeStr, ...) local value for i = 1, select('#', ...) do   value = select(i, ...) if type(value) ~= typeStr then return false end end return true end