Bruce Wilcox - Nov 9, 2016:
It sounds like you want to create a pre-initialized global variable for a topic, something like ~pets_timeout.
You can use a table for this. Since you want to do this presumably for a bunch of topics, create a tablemacro and then at the top of each topic file you care about, just put the table macro and pass as argument the topic name sans ~, then the table has the values for initializing and the table code joins your topic name and planned rest of name, like _timeout and assigns the value. This all runs at build time
Alright, from what I understood I tried the following:
tablemacro: ^setTopicDefaults(^topic ^timeout)
$varTimeout = ^join(\$ ^topic _timeout)
^$varTimeout = ^timeout
table: ^setTopicDefaults()
pets 10
But both $varTimeout and $pets_timeout are null at runtime.
What am I doing wrong here?