The template:
#set $namesList = ['Moe','Larry','Curly'] $namesList #set global $toes = ['eeny', 'meeny', 'miney', 'moe'] $toes
The output:
['Moe', 'Larry', 'Curly'] ['eeny', 'meeny', 'miney', 'moe']
The generated code:
1 namesList = ['Moe','Larry','Curly'] 2 write(filter(namesList)) # generated from '$namesList' at line 2, col 1. 3 write('\n') 4 globalSetVars["toes"] = ['eeny', 'meeny', 'miney', 'moe'] 5 write(filter(VFS(SL,"toes",1))) # generated from '$toes' at line 4, col 1. 6 write('\n')
globalSetVars
is a local variable shadowing ._globalSetVars
.
Writes go into it directly, but reads take advantage of the fact that
._globalSetVars
is on the searchList. (In fact, it's the very first
namespace.)