OOP

(in ./Carbon/OOP.lua)

Provides object orientation features for Carbon.


Methods

class public OOP:StaticClass()

Returns StaticClass

Creates a static class, enabling it to inherit from other objects without having instantiation capability.


class public OOP:Class([Class based_on])

Returns Class

  • optional based_on: A class to make a direct copy of for the basis of this class.

Creates a new, empty class.


class public OOP:RegisterAttribute(string type, string name, function method)

Returns void

  • required type: The type of attribute (Class, PreInitialize, PostInitialize, or Copy).
  • required name: The name of the attribute as a class would call it.
  • required method: The class applicator. For function signatures, see below.

Registers a new custom class attribute.

  • Class: void function(class)
    Called immediately when the attribute is added to the class.
  • PreInitialize: void function(class, instance)
    Called after instance allocation but before the object's initializer is called.
  • PostInitialize: void function(class, instance)
    Called after the object is fully initialized.
  • Copy: void function(original, copy)
    Called after the copied object has been allocated and filled.


class public OOP:SetAttributeInherited(string name, bool inherited)

Returns void

  • required name: The name of the attribute to define a value for.
  • required inherited: Whether inheriting a class will also inherit this attribute.

Marks an attribute as inherited or not inherited explicitly.


Properties

[none]