User Tools

Site Tools


concepts:variables:references

Variable References

Variable references allow you to inline the value of a variable into a command. So, given the variable:

zone.variable1=Hello

The command:

message: $zone.variable1 Dave

Would produce the text “Hello Dave” in the system log 1).

Note that the reference:

  • Must start with a $
  • Must end with a space or a reserved character
  • Cannot contain a space or a reserved character 2)

Another thing to consider: references will only be interpolated up to the first occurrence of ::, which is the delimiter used for commands that are parameters of other commands - so these parameter commands will be passed with references intact.

Variable references are interpolated before anything else is done with the command (including dynamic object interpolation. References that can't be resolved (e.g. the variable doesn't exist) are left as they are.

1)
This is just an example - the reference can be used for any parameter of any command. You could even use it to dynamically call commands, but that way madness lies…
2)
for longer variable names, consider using camel case or snake case
concepts/variables/references.txt · Last modified: 2024/09/20 07:47 by 127.0.0.1