Access parameters via selectors
masterVariables provided in the parameters can be accessed using several selector methods:
- String Literals: Access variables directly by name (e.g.,
foo). - Bracket Selector
[]: Access elements in maps, arrays, or specific struct fields (e.g.,foo[0]orfoo["bar"]). - Dot Selector
.: Access nested variables where the name contains only letters and underscores (e.g.,foo.bar). - Fields and Methods: If a parameter is a struct, you can access its fields and methods directly (e.g.,
foo.Helloorfoo.World()).
Note on Performance: Using accessors (fields/methods) on structs is approximately four times slower than using direct parameters. For better performance, define logic as functions rather than relying on struct method access.