summaryrefslogtreecommitdiffstats
path: root/awall/object.lua
blob: bffd384681fd078ccd529d887159a47fe8285163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--[[
Class model with inheritance and morphing support for Alpine Wall
Copyright (C) 2012 Kaarle Ritvanen
See LICENSE file for license details
]]--


module(..., package.seeall)

function class(base)
   local cls = {}
   local mt = {__index = cls}

   if not base and Object then base = Object end
   if base then setmetatable(cls, {__index = base}) end

   function cls.new(...) return cls.morph({}, unpack(arg)) end

   function cls:morph(...)
      setmetatable(self, mt)
      self:init(unpack(arg))
      return self
   end

   return cls
end

Object = class()

function Object:init(...) end