Vorlage:Boilerplate module

ZIM HilfeWiki - das Wiki

local class = require('Module:Middleclass').class local className = class('Name') local classDebug = require('Module:Debug/class')

-- **************************************************************** -- * properties * -- ****************************************************************

-- **************** initialization of table for private properties local _private = setmetatable({}, {__mode = "k"}) -- weak table storing all private attributes

-- **************** declaration of private static properties -- local _PROPERTY = require( 'Module:' )

-- *************************************************************** -- * methods * -- ***************************************************************

-- **************** declaration of static methods local _privateMethodAhead -- declaration ahead, so this private method can be used in the constructor and in other private methods function className:initialize(var) -- constructor local dbg = classDebug:new('className_id_' .. var) -- initialize all private properties _private[self] = { dbg = dbg, var = true, } _private[self].dbg:log(1, 'Initializing object "' .. var ..'"') end

function className.static:staticMethod(var) _private[self].dbg:log(1, 'entering className.static:staticMethod() to do something') end


-- **************** declaration of private methods local _privateMethod = function (self) _private[self].dbg:log(1, 'entering _privateMethod() to do something') end


-- **************** declaration of public methods function className:__tostring() _private[self].dbg:log(1, 'entering className:__tostring() to do something') return tostring(self:getOutput()) end

function className:method() _private[self].dbg:log(1, 'entering className:method() to do something') return true end

return className

Cookies helfen uns bei der Bereitstellung des ZIM HilfeWikis. Bei der Nutzung vom ZIM HilfeWiki werden die in der Datenschutzerklärung beschriebenen Cookies gespeichert.