I was trying to use LOCALVARS, but when you have more than 1 level it's a nightmare.
Because 1 SUB can alter the LOCALVARS value for all SUBs.
See example bellow.
It would be nice to :
- -LOCALVARS to be set locally or user another keyword LOCALVARSLOC
That way it would not affect the value of LOCALVARS in the sublevels
- -or be able to create/access LOCAL and other levels variables using:
LetLevelVar>t=1,Level (Level=LOCAL;ABOVE,0)
GetLevelVar>%var1%,Level,result (Level=LOCAL;ABOVE,0)
Code: Select all
SRT>sub2
Let>LOCALVARS=1
Let>a=4
Let>LOCALVARS=0
Let>ret=TRUE
END>sub2
SRT>sub1
Let>LOCALVARS=1
Let>a=2
gosub>sub2
Let>a=3
MessageModal> a: %a% ' prints 2
Let>LOCALVARS=0
Let>ret=FALSE
END>sub1
Let>a=1
Let>ret=TRUE
gosub>sub1
MessageModal> a: %a% ' prints 3