Jump to content
  • 0

= operator to assign variables not working if variable is getarg


Leeg

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  120
  • Reputation:   44
  • Joined:  11/13/11
  • Last Seen:  

I can do this:

if (!getarg(1)) set getarg(1), $@warpwaitingpc[0];

But I can't do this:

if (!getarg(1)) getarg(1) = $@warpwaitingpc[0];

parse_line: expected ';'

 

Intended behaviour? I thought 'set' was no longer needed in any context.

Edited by Leeg
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  230
  • Reputation:   131
  • Joined:  11/21/11
  • Last Seen:  

I have no idea how this even worked for you in the first place...

getarg() is a function, not a variable, you just cannot set a value, it just gets the value you passed when calling the function.

you need a variable

.@i = getarg(1);
if (!.@i) .@i = $@warpwaitingpc[0];

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  120
  • Reputation:   44
  • Joined:  11/13/11
  • Last Seen:  

So... it shouldn't be working with 'set' in the first place...  ;D I guess I'll modify my code.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

in your case, you have to use the set() script command.

if (!getarg(1)) set getarg(1), $@warpwaitingpc[0];

if I recall correctly this should be the case.

Edited by Emistry
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  120
  • Reputation:   44
  • Joined:  11/13/11
  • Last Seen:  

Yes. I already knew it works with set. ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...