-- -*- coding: utf-8 -*-
--[[
Copyright 2013 Stephan Hennig
This file is part of Padrinoma.
Padrinoma is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Padrinoma is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public
License along with Padrinoma. If not, see
--
-- Every object (class or instance) derived from this class provides at
-- least three fields:
--
--
super
new(self, o)
obj =
-- parent:new()
init(self)
new()
. Argument is the newly created instance.
-- Initialization can be chained by calling
-- parent.super.init(self)
within
-- init()
, usually as the first operation.-- -- luadoc -d API *.lua -- ---- @trick Prevent LuaDoc from looking past here for module description. --[[ Trick LuaDoc into entering 'module' mode without using that command. module(...) --]] -- Local module table. local M = {} --- Initialize object. -- -- @param self Callee reference. local function init(self) end M.init = init --- Constructor. -- -- @param self Callee reference. -- @param o Optional existing object. -- @return A new trie object. local function new(self, o) -- Create object. o = o or {} -- Set metatable to parent class. setmetatable(o, self) self.__index = self -- Reference to parent class. o.super = self -- Initialize new object. o:init() return o end M.new = new -- Export module table. return M