Extensions New Object Class

object mmf.newObjectClass ( string name )

The newObjectClass function takes the name of an object class (an object listed in the workspace toolbar), and returns a specialized table (an object, in programming terms) representing the object class.

Object class tables are unique.  If you call newObjectClass on the same name multiple times, a reference to the same table will be returned each time, even if you lose all references to the table.  If you add additional fields or methods to the table, they will still be there the next time newObjectClass is called for the same name.

See Object Class API for more information about object classes.

Parameters

name The name of an object class in the frame 

Return Values

object An object representing an object class on the frame

Example

-- Assume there is an object of the frame named "Goomba"
local GoombaClass = mmf.newObjectClass("Goomba")
 
assert(GoombaClass ~= nil)
assert(GoombaClass.className == "Goomba")
 
-- Print the number of object instances for this class
print(GoombaClass.objectCount)


See also:
     Object Classes, New Object

Copyright 2010 Justin Aquadro