From: Steven Barth Date: Tue, 22 Jul 2008 14:40:53 +0000 (+0000) Subject: libs/core: Add in-line documentation for luci.util.class X-Git-Tag: 0.8.0~595 X-Git-Url: http://git.archive.openwrt.org/?a=commitdiff_plain;h=33b8cf5506ca070862a2bbb13925b0d8f48b138d;p=project%2Fluci.git libs/core: Add in-line documentation for luci.util.class --- diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 443d5f303..c8507798f 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -27,7 +27,20 @@ limitations under the License. module("luci.util", package.seeall) --- Lua simplified Python-style OO class support emulation +--- Creates a Class object (Python-style object model) +-- Creates a new class object which can be instantiated by calling itself. +-- Any class functions or shared parameters can be attached to this object. +-- Attaching a table to the class object makes this table shared between +-- all instances of this class. For object paramters use the __init__ function. +-- Classes can inherit member functions and values from a base class. +-- Class can be instantiated by calling them. All parameters will be passed +-- to the __init__ function of this class - if such a function exists. +-- The __init__ function must be used to set any object parameters that are not shared +-- with other objects of this class. Any return values will be ignored. +-- @see instanceof +-- @see clone +-- @param base the base class to inherit from (optional) +-- @return class object function class(base) local class = {}