nil value false Value

true (value)


The true value is a boolean type value that is non-zero. It is the only alternative of the boolean false. Both data and methods can use the value true as a test or flag value.

Examples

Suppose we want to attach the image pointer image to CImage object I. The example below shows 2 equivalent ways to test the returned value:

 

bSuccess = I:Attach( image )

-- returns true if the image is attached.

if ( bSuccess ~= true ) then Exit() end

-- exit if bSuccess is not true

Alternatively, the same result is accomplished by the following code:

 

bSuccess = I:Attach( image )

-- returns true if the image is attached.

if ( not bSuccess ) then Exit() end

-- exit if bSuccess is not true

Related Topics

false, nil