made Object non-global

This commit is contained in:
kikito 2013-09-15 23:18:08 +02:00
parent 88e84d13c2
commit cd9609e1ae
7 changed files with 9 additions and 1 deletions

View File

@ -94,7 +94,7 @@ local function _includeMixin(klass, mixin)
klass.__mixins[mixin] = true klass.__mixins[mixin] = true
end end
Object = _createClass("Object", nil) local Object = _createClass("Object", nil)
Object.static.__metamethods = { '__add', '__call', '__concat', '__div', '__le', '__lt', Object.static.__metamethods = { '__add', '__call', '__concat', '__div', '__le', '__lt',
'__mod', '__mul', '__pow', '__sub', '__tostring', '__unm' } '__mod', '__mul', '__pow', '__sub', '__tostring', '__unm' }
@ -157,6 +157,8 @@ function middleclass.class(name, super, ...)
return super:subclass(name, ...) return super:subclass(name, ...)
end end
middleclass.Object = Object
setmetatable(middleclass, { __call = function(_, ...) return middleclass.class(...) end }) setmetatable(middleclass, { __call = function(_, ...) return middleclass.class(...) end })
return middleclass return middleclass

View File

@ -1,4 +1,5 @@
local class = require 'middleclass' local class = require 'middleclass'
local Object = class.Object
context('Object', function() context('Object', function()

View File

@ -1,4 +1,5 @@
local class = require 'middleclass' local class = require 'middleclass'
local Object = class.Object
context('class()', function() context('class()', function()

View File

@ -1,4 +1,5 @@
local class = require 'middleclass' local class = require 'middleclass'
local Object = class.Object
context('includes', function() context('includes', function()

View File

@ -1,4 +1,5 @@
local class = require 'middleclass' local class = require 'middleclass'
local Object = class.Object
context('instanceOf', function() context('instanceOf', function()

View File

@ -1,4 +1,5 @@
local class = require 'middleclass' local class = require 'middleclass'
local Object = class.Object
context('Metamethods', function() context('Metamethods', function()

View File

@ -1,4 +1,5 @@
local class = require 'middleclass' local class = require 'middleclass'
local Object = class.Object
context('subclassOf', function() context('subclassOf', function()