MiddleClass Extensions
1.0
This is the repository for my extensions to MiddleClass, done in the style of the MiddleClass Extras.
Currently only one extension is here, which is called Static. Static's purpose is to allow you to make some functions accessible through the class alone. Normally all functions declared are accessible through the class and all instances. Here's an example of using Static:
require 'middleclass.init'
require 'Static'
Foo = class('Foo'):include(Static)
function Foo:classOnly()
print('hello class!')
end
function Foo:classOnly2()
print('hello class again!')
end
function Foo:normal()
print('hello world!')
end
Foo:static('classOnly', 'classOnly2')
f = Foo()
f:normal() -- hello world!
Foo:classOnly() -- hello class!
Foo:classOnly2() -- hello class again!
f:classOnly() -- no method