Commits

Bart van Strien  committed 19ae173

Add private class definitions

  • Participants
  • Parent commits 2299707

Comments (0)

Files changed (2)

 	end
 end
 
-function class(name)
-	return function(...)
-		return inheritance_handler(true, name, ...)
-	end
-end
+class = setmetatable({
+	private = function(name)
+		return function(...)
+			return inheritance_handler(false, name, ...)
+		end
+	end,
+}, {
+	__call = function(self, name)
+		return function(...)
+			return inheritance_handler(true, name, ...)
+		end
+	end,
+})
+
 
 function issubclass(class, parents)
 	if parents.__class__ then parents = {parents} end
 	}
 	assert(test == Test)
 end)
+
+Test("Private class definition", function()
+	local test = class.private "TestClass" {
+	}
+	assert(TestClass == nil)
+	assert(test)
+end)