Custom type property binding

Feb 15, 2012 at 2:15 PM

Hi Roman,

I would like to bind a custom type property (or field), exposed on an instanciated type injected in the LanguageRuntime at construction time, and being able to index access it directly in the expression script.

For example :

MyCollection[1].TotalAmount >= 1200

Where MyCollection is a List<T> property of my custom type.

I found the method binding pattern (BuiltIns.AddMethod). However, if i use this approach, i would have to use a method call syntax in the script (with parenthesis). 

MyCollection(1).TotalAmount >= 1200

or

x = MyCollection()
x[1].TotalAmount >= 1200

Both previous syntax are a bit overwhelming. Direct access to the collection type in the script would be super cool.

Do you have any suggestion ?

 


Coordinator
Feb 15, 2012 at 2:59 PM

there's Globals collection for all global variables - add the object there

Feb 15, 2012 at 3:17 PM

Awesome, works like a charm.

Thanks for your quick answer!