CStats:new


The new method creates an instance of the CStats class. This method returns to the caller a reference to the object it creates. The calling code must assign this reference to a name (see below). If the object cannot be created, nil is returned.

Note: This method's name uses all lower case to present it as the analog of the C++ new operator. Generally, the names of class methods begin with an uppercase letter but new and delete are different.

Syntax

S = CStats:new()

where

 

    S is the new CStats object. If it cannot be created, nil is returned.

Example

 

S = CStats:new()

-- create a new instance of S of the CStats class.

  --

-- other uses of the class go here, between new and delete.

S:delete()

-- deletes the object and its associated memory.

Related Topics

delete

CStats Class