libbbb - Better variables

29 Jul 2013

Variables were updated in rexscript while preparing for 1.2.1. We can use:

 1 # replaced by first value in the array
 2 {{ var_name }}
 3 {{ var_name[0] }}
 4 {{ var_name[first] }}  
 5 # replaced by second value in the array
 6 {{ var_name[1] }}
 7 {{ var_name[second] }}   
 8 # replaced by last value in the array
 9 {{ var_name[-1] }}
10 {{ var_name[last] }}
11 # replaced by third value in the array
12 {{ var_name[2] }} 

Content of the array may be glued into a single construct like so:

 1 # simply glue them, no marker between
 2 {{ var_name.join() }}
 3 # glue using a single space
 4 {{ var_name.join( ) }}
 5 {{ var_name.join(\s) }}
 6 # glue them with new lines or tabs between
 7 {{ var_name.join(\n) }}
 8 {{ var_name.join(\t) }}
 9 # glue with some text
10 {{ var_name.join(some text) }} 

We can also use a new way of setting the content:

1 SETB SomeVar
2    value at index 0
3    value at index 1
4    value at index 2
5    value at index 3
6 END