Page 1 of 1

Info about LoadVariables

PostPosted: Sun Jan 02, 2005 4:06 pm
by Sam Cox
Wanting to know more about LoadVariables, I constructed the following test file and made these observations.

(a) only lines with equal signs have any effect
(b) same as SetVar "[var1a]" "=double equal signs (b)"
(c) some lines with equal signs appear to have no effect
(d) spaces are significant as these lines demonstrate
(e) important difference between these two lines
(f) NeoBook is "generous" when it comes to left-side brackets
(g) it is possible to construct some bizzare variables
(h) lines with semi-colon as 1st non-white char are comments WRONG, no comments!
(i) this one actually redefined [#34]
j) "variables" on right side of equal sign not evaluated by LoadVariables

Code: Select all
THIS IS THE FIRST LINE (a)
THIS LINE NO EQUAL SIGN (apparently ignored)
NEXT LINE IS BLANK (apparently ignored)

NEXT LINES HAVE MULTIPLE EQUAL SIGNS
var1=var2=var3
;var1=this is a comment (h) — WRONG!
 ;var1=this is also a comment (h) — WRONG!
var1a==double equal signs (b)

NEXT LINE HAS NO VARIABLE (c)
=var2

NEXT LINE HAS NO VARIABLE OR VALUE (c)
=

NEXT LINE VERY BIZZARE (d)
 =one space before equal sign; result in [ ]

NEXT LINE NO VALUE; SAME AS SETVAR "[VAR3]" "" (e)
var3=

NEXT LINE NO EQUALS SIGN; NOT SAME AS SETVAR "[VAR4]" "" (e)
var4

NEXT LINE CONTAINS A PIPE CHARACTER
var5=this line has one pipe | character

NEXT LINES HAVE A SPACE AFTER OR BEFORE EQUAL SIGN (d)
var6= one space after equal sign
var7 =one space after variable name; result in [var7 ]
 var8=one space before variable name; result in [ var8]

NEXT LINES HAVE QUOTES
var9="this line has double quotes"
var10='this line has single quotes'
var11=[#34]this line has Neo quotes[#34]

NEXT LINES HAVE BRACKETS (f) (j)
var12=[this line has brackets]
var13=[this line has [multiple] brackets]
[var14]=balanced brackets on left side; result in [var14]
[var15=only left bracket on left side; result in [var15]
var16]=only right bracket on left side; result in [var16]

NEXT LINES HAVE PERIODS
.var17=period before var name; result in [.var17]
var18.=period after var name; result in [var18.]

NEXT LINES HAVE QUOTES ON VARIABLE SIDE (g)
"var19"=balanced DQ around var name; result in ["var19"]
'var20'=balance SQ around var name; result in ['var19']

NEXT LINES HAVE NUMBERS FOR VAR NAMES! (g)
1=2 ..result in [1]
3.141592654=pi ..result in [3.1415926564]

NEXT LINE HAS [#nnn] SYNTAX FOR VARIABLE NAME (i)
[#34]=seems wrong to me; result in [#34]

THIS IS THE LAST LINE

Update 2005-01-03: Turns out that a leading equal sign (=) on a line (must be the first character on the line—no preceding white space) serves nicely as a comment character. When LoadVariables reads the following line, no assignment is made to the [test] variable.

Code: Select all
=test=123

LoadVariables

PostPosted: Tue May 03, 2005 6:35 pm
by dbz
Sam, i must thank you for all the good info i have picked up from you. Practicing the indirect addressing technique i learned from your Bars, I started playing with LoadVariables (learning of course from looking at the SaveVariables flatfile. My hope was to create an Object thru use of Save/LoadVariables. But, there exist only 'your' variables there, which makes sense. But i continue to experiment with a table driven architechture which could be used to build the basis of executable pub, distributed to customers, and thru use of LoadVariables, the Pub would load the lastest catelogue, for example. i don't like to change code to move print lines around.

and Sam, I like the way you code.
dbz