Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A repository for my extensions to MiddleClass.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 middleclass
Octocat-spinner-32 README.md
Octocat-spinner-32 SingleAccessor.lua
Octocat-spinner-32 Static.lua
Octocat-spinner-32 test_Static.lua
README.md

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
Something went wrong with that request. Please try again.