Module clopwh

CLOPWH : Combacsa's Lua ObjectProtocol implementation With Hongminhee.
Author : combacsa (combacsa@gmail.com, aka Byun, Kyuhong aka Francisco)
Supervised by dahlia (minhee@dahlia.kr, aka Hong, Minhee)

CLOPWH Class Hierarchy

  • Object
    • Number
    • String
    • Boolean
    • Nil
    • Function
    • Thread
    • Userdata
    • Table
    • Class
    • [User-defined Classes]

Metaclass Concept (In addition to Class Hierarchy)

Type of Object, Class, and all the other Classes including user-defined ones, is Class. Those are all instance of Class.

sample code

classname = clopwh.Class({ initialize=function() end, function1_name=function(params) --implementation end, ... })

See src/test/hong.lua or src/test/test.lua also.

Functions

Class (declaration) Define a new Class and Return a constructor for defined class.
get_type (object) Returns the type (Class) of given object.
is_a (object, class_name) Returns whether given object belongs to the given class or not.


Functions

Class (declaration)
Define a new Class and Return a constructor for defined class.

Parameters

  • declaration: Class declaration, usually consists of function definition.
    Declaration might include several special functions.
    • initialize: Constructor
    • *, -, /, %, ^, <=, <, ==, ..: Binary operator overloading
    • -, tostring: Unary operator overloading
    All function definition must obey python-like rule: First parameter must be self, and it refers to the caller object.

Return value:

a function which is a constructor for given declaration.
get_type (object)
Returns the type (Class) of given object.

Parameters

  • object: Object to know the class

Return value:

Class for the object

See also:

is_a (object, class_name)
Returns whether given object belongs to the given class or not.

Parameters

  • object: Object to test whether it belongs to given Class
  • class_name: Class (function) to test whether given object belongs to it

Return value:

whether given objec is of given class (according to inheritance)

See also:

Valid XHTML 1.0!