Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
softballs
Newbie


Joined: 15 Sep 2015
Posts: 9

PostPosted: Fri Sep 18, 2015 12:29 am   

SOLVED - Hide return value of a function
 
I am using the following code:

#show %additem("north", path)

I do not want the return value to be sent to the mud that is why i use #show, but my question is can i use something else to just ignore/hide the return value?


Last edited by softballs on Wed Sep 23, 2015 10:41 pm; edited 1 time in total
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Sep 18, 2015 9:04 am   
 
Typically you would use #call for that, but in this case, that would have no effect. The %additem function doesn't actually change the contents of the variable, so normally you would assign the return value from the function back to the variable. Something like this:
Code:
path = %additem("north", @path)
Reply with quote
softballs
Newbie


Joined: 15 Sep 2015
Posts: 9

PostPosted: Wed Sep 23, 2015 10:41 pm   
 
Yeah I didnt notice that at first, code updated to the following and now all is working:

Code:
#var path %additem("north", @path)
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Thu Sep 24, 2015 12:18 am   
 
%additem doesn't modify the list but does return a value.
#additem does modify the list but does not return a value (but note that #additem has the name of the list first and thing to add second, vs the function %additem which does the reverse)

#additem path "north"
is simpler and arguably more to the point of what you want to do.
Reply with quote
softballs
Newbie


Joined: 15 Sep 2015
Posts: 9

PostPosted: Thu Sep 24, 2015 1:35 am   
 
My list contains duplicates though so I cant use #additem
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net