summaryrefslogtreecommitdiff
path: root/common/class.lua
blob: 37cf7bdb7e321e5ec935722e8e2e890400fff990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
local function class()
	local T = {}
	T.__index = T
	return T
end

local function extend(Base)
	local T = {}
	T.__index = T
	for k,v in pairs(Base) do
		if k:sub(1,2) == "__" and k~="__index" then
			T[k]=v
		end
	end
	setmetatable(T,{__index=Base})
end

return setmetatable({
	class=class,
	extend=extend
},{__call=class})