This simple extension allows you to remember things between commands during the same session. For example, you could remember the current contents of the clipboard (obtained via
Clipboard.Get()) for inserting later via a different command. By session, it is meant that all these variables are forgotten each time you exit Vocola or use the "load extensions" command.
) sets the variable name to the value value and the function
) retrieves the current value of the variable name or causes a runtime error if that variable hasn't been set. If you aren't sure if name has been set yet, you can provide a default value (e.g.,
)) and the provided default value will be returned instead of a runtime error occurring if name has not been set yet.
If you want to test the extension, you can use the following Vocola commands:
<v> := (first | second | third); set <v> value 1..10 = Variable.Set ($1, $2); unset <v> value = Variable.Unset($1); show <v> value = Variable.Get($1, UNDEFINED); unsafely show <v> value = Variable.Get($1);