Archive: VAR syntax change?


VAR syntax change?
Hi, I recently upgraded to the most recent version of NSIS (2.37), and my installer no longer compiles. It complains about the syntax of some VAR commands that I have that specify a default value, like so:

VAR Connected 0
VAR DownloadName ""


I see in the manual that VAR doesn't actually support a default value syntax, but this used to work. I also see that in the changelog for 2.32, there is "Fixed syntax validation of Var"

So, did this ever work? If so, how do I specify a default now. Or, how do I even assign an integer value to the variable in another area?

Thanks!

Doesn't work like this?

Var Connected
Var DownloadName

Function .onInit
StrCpy $Connected 0
StrCpy $DownloadName ""
FunctionEnd

You know, it would REALLY be nice to be able to specify the default value of the VAR when its declared, rather than having to do it in .onInit.

Especially since if you have multiple .nsi/.nsh files that declare variables, its very difficult to coordinate all those variables to be initialize in .onInit.

What is the theory about why its not supported in doing it the way he is trying to do it?


I've always been confused about types in NSIS - how does StrCpy work with an int? I thought it was for strings?

As a side note, its always seem bizarre to me that a language based on stack manipulation, GOTOs, and preorder commands has implicit type coersion... *scratches head*


There is no data types in NSIS. When it needs to do integer operations it converts the string value to an integer first.

Stu


Huh, well, I guess that clears that up. Still, it feels incongruous with the rest of the language.

When I get some free time (read: never), maybe I'll sit down and write a simple parser that "compiles" some higher level language constructs down to NSIS script...that would be handy.