CImage:Dup


The Dup method makes a duplicate of the current CImage object. The new CImage object is returned to the script. If, instead, you want this CImage to contain a copy of a different CImage, use the Copy method.

Syntax

CImageNew = CImage:Dup()

where

    CImageNew is a new CImage object which is created and returned to the script. In place of CImage, use the name of the actual object you wish to duplicate.

    On success, this method returns the new object CImageNew.

    On failure, nil. is returned.

Example

Suppose an image file exists with a full path named sPath. The script below shows the image being opened and copied:

I = CImage:new()

-- create a CImage object

bOk = I:Open(sPath)

-- open the image from path sPath.

if not bOk then

-- if not opened, then...

  Exit()

-- leave the script, etc.

end

-- end of if block

Inew = I:Dup()

-- create a new CImage object Inew

Related Topics

Copy

Open

Close

CImage class