View Single Post
Old 12-28-2013, 09:44 PM   #21
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

Changes in pre4:
  • The syntax highlighting and error detection in the editor is way better, as is the parentheses and ?: matching. The syntax highlighting will also highlight obvious errors (mismatched () etc).
  • Literal strings are no longer mutable, you can't change them, you can only read from them.
  • If you wish to use a temporary mutable string, you can use # -- the value is only guaranteed to be preserved for the current section, and could be undefined on the next call. Examples:
    Code:
    str = #;
    sprintf(str, "the value of foo is %{foo}f");
    gfx_draw(str);
    or
    Code:
    str = sprintf(#, "the value of foo is %{foo}f");
    gfx_draw(str);
    or
    Code:
    gfx_draw(sprintf(#, "the value of foo is %{foo}f"));
  • If you wish to have named, persistent, more predictable strings, which also appear in the watch window, you can use #name.
    Code:
      strcpy(#mystring, "hello world");
      gfx_draw(#mystring);
      sprintf(#otherstring, "hello: %{#mystring}s");
    You can also do things like:
    Code:
      s = #mystring;
      strcpy(s,"hello");
    Also, I should mention that if a #string is on the left side of = or +=, it will alias to strcpy() or strcat(), so for example:
    Code:
      #str = "hello";
      s = "world";
      #str += " ";
      #str += s;
      // #str is now "hello world"
  • Another thing that changed is you can no longer have expressions like:
    Code:
    1=2;
    This was rarely used, but it breaks two plug-ins (Jonas DrumReaplacer and Vmorph). You can still have more complex expressions like (1 ? 2 : 3) = 4, which is equally meaningless...
Justin is offline   Reply With Quote