Type Function Object CoronaClass Library none Return value CoronaPrototype Revision 2017.3060
Constructor for creating new object instances. The object
is assumed to be a class object.
object:new() object:new( params )
Table. Optional table of parameters which can be passed to new()
and forwarded to initialize()
which can be overridden by subclasses.
local Prototype = require( "CoronaPrototype" ) local paramsTable = { value = 3 } local Foo = Prototype:newClass( "Foo" ) function Foo:initialize( params ) print( params.value ) end -- Pass params to initialize() which prints '3' Foo:new( paramsTable )