local v={}function v.Add(E,v)assert(not v.IsA,"\099\108\097\115\115 \097\108\114\101\097\100\121 \104\097\115 \097\110 \073\115\065 \109\101\116\104\111\100")assert(not v.CustomIsA,"\099\108\097\115\115 \097\108\114\101\097\100\121 \104\097\115 \097\110 \067\117\115\116\111\109\073\115\065 \109\101\116\104\111\100")assert(v.ClassName,"\099\108\097\115\115 \110\101\101\100\115 \097 \067\108\097\115\115\078\097\109\101")v.IsA=E.IsA v.CustomIsA=E.IsA end function v.IsA(E,v)assert(type(v)=="\115\116\114\105\110\103","\099\108\097\115\115\078\097\109\101 \109\117\115\116 \098\101 \097 \115\116\114\105\110\103")local F=getmetatable(E)while F do if F.ClassName==v then return true end F=getmetatable(F)end return false end return v
--- Generic IsA interface for Lua classes.
-- @module IsAMixin

local IsAMixin = {}

--- Adds the IsA function to a class and all descendants
function IsAMixin:Add(class)
	assert(not class.IsA, "class already has an IsA method")
	assert(not class.CustomIsA, "class already has an CustomIsA method")
	assert(class.ClassName, "class needs a ClassName")

	class.IsA = self.IsA
	class.CustomIsA = self.IsA
end

--- Using the .ClassName property, returns whether or not a component is
--  a class
function IsAMixin:IsA(className)

	assert(type(className) == "string", "className must be a string")

	local CurrentMetatable = getmetatable(self)
	while CurrentMetatable do
		if CurrentMetatable.ClassName == className then
			return true
		end
		CurrentMetatable = getmetatable(CurrentMetatable)
	end

	return false
end

return IsAMixin