Variables and TypesVariables in TrafficScript can contain data of various types: integer, floating point (double) or string. TrafficScript automatically casts (converts) values and variables into the correct type when you evaluate an expression or call a function:
Strings and doubles are rounded up or down to the nearest integer value when they are cast to integers. $int = 10; $double = 2.71828; string.len( $int ); # casts to string, returns 2 string.len( $double ); # casts to string, returns 7 # Set $string to "10, 2.71828" $string = $int . ", " . $double; # Convert $string to a number, and add 4: $r = $string + 4; # $r is 14 In a mixed-type operation such as a compare, where all types are allowed:
Owen Garrett
[Zeus Dev Team] 01 July 2005
|
Recent Articles
Other Resources
|


