CFile:new
The new method creates an instance of the CFile class. Your code must assign this reference to a name (see below) to allow you to work with the class. If the object cannot be created, the value nil is returned.
As an alternative to using this constructor followed by the Open method, you can use the global FileOpen method to both construct the CFile object and open the file.
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.
F = CFile:new() where The new CFile object, F, is returned. If it cannot be created, nil is returned. The new CFile object is not initially attached to a file. |
|
|
|
-- create a new instance of F of the CFile class. |
-- |
-- other uses of the class go here, between new() and delete(). |
|
-- deletes the object and its associated memory. |