Lingo Dictionary > G-K > ilk()

 

ilk()

Syntax

ilk(object)
ilk(object, type)

Description

Function; indicates the type of an object.

The syntax ilk(object) returns a value indicating the type of an object. If the object is a list, ilk(object) returns #list; if the object is a property list, ilk(object) returns #propList.

The syntax ilk(object, type) compares the object represented by object to the specified type. If the object is of the specified type, the ilk() function returns TRUE. If the object is not of the specified type, the ilk() function returns FALSE.

The following table shows the return value for each type of object recognized by ilk():

Type of Object

ilk(Object) returns

ilk(Object, Type) returns 1 only if Type =

Example

linear list

#list

#list or #linearlist

ilk ([1,2,3])

property list

#proplist

#list or #proplist

ilk ([#his: 1234, #hers: 7890])

integer

#integer

#integer or #number

ilk (333)

float

#float

#float or #number

ilk (123.456)

string

#string

#string

ilk ("asdf")

rect

#rect

#rect or #list

ilk (sprite(1).rect)

point

#point

#point or #list

ilk (sprite(1).loc)

color

#color

#color

ilk (sprite(1).color)

date

#date

#date

ilk (the systemdate)

symbol

#symbol

#symbol

ilk (#hello)

void

#void

#void

ilk (void)

picture

#picture

#picture

ilk (member (2).picture)

parent script instance

#instance

#object

ilk (new (script "blahblah"))

xtra instance

#instance

#object

ilk (new (xtra "fileio"))

member

#member

#member

ilk (member 1)

xtra

#xtra

#object

ilk (xtra "fileio")

script

#script

#object

ilk (script "blahblah")

castlib

#castlib

#object

ilk (castlib 1)

sprite

#sprite

#object

ilk (sprite 1)

sound

#sound

#object

ilk (sound "yaddayadda")

window

#window

#object

ilk (the stage)

media

#media

#object

ilk (member (2).media)


Example

The following ilk statement identifies the type of the object named Bids.

Bids = [:]
put ilk( Bids )
-- #proplist

Example

The following ilk statement tests whether the variable Total is a list and displays the result in the Message window:

Total = 2+2
put ilk( Total, #list )
-- 0

In this case, since the variable Total is not a list, the Message window displays 0, which is the numeric equivalent of FALSE.

Example

The following example tests a variable named myVariable and verifies that it is a date object before displaying it in the Message window:

myVariable = the systemDate
if ilk(myVariable, #date) then put myVariable
-- date( 1999, 2, 19 )