Archive: Var question


Var question
Hi,

I tried to make a local variable with the following code,
but the compiler turns out an error, that it's an invalid
command. (input: Var inst_comment)

I tried to look up whether this keyword is deprecated or
not but did'nt find any sign of it.
Can anyone please help me?

Thanks, in advance


Var can not create local variables, only global. You must also define the variable before you use it.


I was thinking, it would be nice if you could use...
Var MyVar "Hello Jim!"
...where "Hello Jim!" would be $MyVar's starting value.

-Stu


Just copy something into it in .onInit. This would be possible when compiler plug-ins are implemented, hopefully in 2.1.


Hi,

thanks for the reply but I think I didn't describe my problem
well. :( My problem is that the following example does not compile:

Var $labelstr

Section
detailprint $labelstr
SectionEnd

Function .onInit
StrCpy labelstr "text"
FunctionEnd

The version I'm using is: MakeNSIS v2.0b3
The error message is the following:
---
Processing script file: "C:\TEMP\var_test.nsi"
Invalid command: Var
Error in script "C:\TEMP\var_test.nsi" on line 1 -- aborting creation process
---

I tried it many ways but as far as I know it should work.
Is there any other way to specify a variable?
regards,

sirius.onyx


Var is not present in b3 and prior versions. It's only present in the latest CVS version. See the development page on the NSIS homepage (find a link in my signature) for more information about obtaining the latest CVS version.


also, you define vars with "Var labelstr" not with "Var $labelstr"