All Manuals > LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual > 1 Introduction to the Objective-C Interface > 1.3 Invoking Objective-C methods

NextPrevUpTopContentsIndex

1.3.4 Invoking a method that returns a boolean

When a method has return type BOOL , the value is converted to the integer 0 or 1 because Objective-C cannot distinguish this type from the other integer types. Often it is more convenient to receive the value as a Lisp boolean and this can be done by using the function invoke-bool, which returns nil or t .

For example, a call in Objective-C such as:

[box isSquare] ? 1 : 2

could be written using invoke-bool as:

(if (invoke-bool box "isSquare") 1 2)

LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 15 Dec 2011

NextPrevUpTopContentsIndex