Lasso Soft Inc. > Home

[ any->invoke ]

Method

This method is called when ever a type is invoked using parens()

  • Syntax
any->invoke

any()
Examples
  • Beginner
  • Intermediate
  • Advanced

When a string is invoked it simple returns itself.

Code

local( mylocal = 'My string' )

#mylocal->invoke

Result

My string

You can also ->invoke by using parens()

Code

local( mylocal = 'My string' )

#mylocal()

Result

My string

Below is a simple counter type that overides the default ->invoke method.

Code

define mycounter => type {
    data public count = 1
    public invoke() => .'count'++ 
}

local( mylocal = mycounter )

#mylocal()
#mylocal()
#mylocal()

Result

123

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 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft