Level 3, lesson 6

# 3.6 A portable way to access application variables

A host program can add special variables to the 4tH environment. If 4tH is used as a scripting language in e.g. a printer program, the programmer can "send" variables to 4tH. These variables are called "application variables". Do not confuse them with 4tH variables, like 'BASE' or '>IN' which are used internally by 4tH. 4tH doesn't do anything with application variables.

If the creator of the host program provided special names for each of these variables, he will probably have documented them. However, even if he didn't there is another way to access these variables.

They are stored in a predefined array called 'APP' and its values can be fetched like any other array, e.g.:

         app 1 th @

Which fetchrs the value of the second element in the array. This also enables you to write programs that can be compiled and run under all "standard" versions of 4tH.