Search code examples
syntaxnsis

NSIS has 2 ways of declaring variables and for Conditional Statements


Something thats really annoying me with NSIS is why there are 2 different ways of doing things?

  1. Why have 2 ways of performing conditional statements/logic. Ie, use '$if' or use 'StrCmp'?
  2. Why be able to store variables in many different ways. Ie, use '$myvar' or use 'var myVar' and I think theres more
  3. Why have assembly to access store variables? Why not just use the above methods
  4. Why can you create a comment by using both ';' or '#'

Can you suggest a link that documents all the global variables? Such as $INSTDIR and others?


Solution

  • You clearly haven't understood all of how NSIS works.

    1. ${If} and all of those things are from LogicLib, which was added to the NSIS standard library after it had been in existence for a long time. Formerly, you had to use StrCmp, IntCmp, or one of those jump operators. ${If} a == b is just syntax sugar around StrCmp with the labels all taken care of. It produces much more maintainable code.

    2. Var foo is the variable declaration. $foo is accessing the variable. They are thus quite different things. You can't use $foo without having already specified Var foo.

    3. I haven't a clue what you mean by this.

    4. Does it matter?

    5. Look in the manual. It's all there in plain sight. Try the Variables section.