object:initialize()

Type Function
Object CoronaPrototype
Library none
Revision Release 2024.3703

Overview

Subclasses can override this method to provide custom initialization of instances.

Syntax

object:initialize()

Example

local Prototype = require( "CoronaPrototype" )

local MyClass = Prototype:newClass( "MyClass" )

function MyClass:initialize()
    -- custom init
    self.foo = "bar"
    return self
end

local instance = MyClass:new()
print( instance.foo )