Lasso Soft Inc. > Home

[ isa ]

Method

Requires a type name as a parameter. Returns True if the base object is of that type or has that type as a parent type. Note that Null is the base type for all objects in Lasso. Using [Null->isa('Null')] will always return true. 

  • Syntax
null->isA(::typetocheck)

null->isA('typetocheck')
Examples
  • Beginner
  • Intermediate

To check the type of an object:

Use the [Null->IsA] tag. The following example checks a local to see whether it is a string before performing a string operation on it.

Code

local(mystring='red,green,blue')

if(#mystring->isA('string')) => {
   local(myarray = #mystring->split(','))
else
   local(myarray = array)
}
#myarray

Result

array(red, green, blue)

Check to see if a thread variable is initialised — if not redefine it.

Code

! var(myvar)->isA(::array)
? $myvar = array('a','b','c')

$myvar

Result

array(a, b, c)

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft