  | 
	
	
	
		DeathDealer Adept
  
  Joined: 20 Jul 2004 Posts: 268
 
  | 
		
		  
			
			   Posted: Fri Apr 01, 2005 7:39 pm   
  #function & #var same or diff?   | 
			 
			
				Something that I noticed while working on a reporter
 
if you have a #function and look at it in settings it gives the same icon as a #var.
 
And when u export it it calls it a #var
 
 
#FUNCTION addcommas {%subregex(%1,"(\d(1,3)?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))","%%1,")}
 
#FUNCTION padleft {%concat( %repeat( " ", %eval( %3-%len( %1))), %1)}
 
 
export:
 
#VAR addcommas {%subregex(%1,"(\d(1,3)?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))","%%1,")}
 
#VAR padleft {%concat( %repeat( " ", %eval( %3-%len( %1))), %1)}
 
 
And then when you import them it comes out wrong and says that both of them have values of %1
 
 
How the heck do you get it NOT to export as a #var.
 
It just makes it hard to export the script to send to someone if you forget that the conversion happens. | 
			 
		  | 
	
	
	  
		  
		    
			  _________________
   | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		nexela Wizard
  
  Joined: 15 Jan 2002 Posts: 1644 Location: USA
  | 
		
		  
			
			   Posted: Fri Apr 01, 2005 9:44 pm      | 
			 
			
				You can't and it sucks because everytime I export my scripts I have to go through and change the #VAR to #FUNC. But the only differance between #VAR and #FUNC is how its expanded/evaluted when it is created.
 
 
Both of these are the same
 
#VAR name "" //doesn't expand
 
#FUNC name {} //doesn't expand
 
 
however normal Variable operation is this
 
#VAR name {} //does expand | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		DeathDealer Adept
  
  Joined: 20 Jul 2004 Posts: 268
 
  | 
		
		  
			
			   Posted: Fri Apr 01, 2005 10:07 pm      | 
			 
			
				sooo....meaning that rather than have them as #functions I can put them in #vars if i have them surrounded by {}'s?
  | 
			 
		  | 
	
	
	  
		  
		    
			  _________________
   | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		Vijilante SubAdmin
  
  Joined: 18 Nov 2001 Posts: 5187
 
  | 
		
		  
			
			   Posted: Sat Apr 02, 2005 4:16 am      | 
			 
			
				In state of fact, #FUNCTION's are a specialized type of #VARIABLE's.   The import and export abiltities are meant to operate in verbatim mode.  However the subtle difference between #FU and #VAR is lost.  This has been a point of contension betwixt Zugg and I for a long time, and has actually lead to me avoiding the use of #FUNCTION entirely.  In general if you export a script that makes use of #FUNCTION's you should correct the exported version to assure that the script is properly importable.
  | 
			 
		  | 
	
	
	  
		  
		    
			  _________________ The only good questions are the ones we have never answered before.
 
Search the Forums | 
			       | 
			 
		   
		 | 
	
	
		  | 
	
	
		Vitae Enchanter
  
  Joined: 17 Jun 2005 Posts: 673 Location: New York
  | 
		
		  
			
			   Posted: Thu Jun 30, 2005 4:31 pm      | 
			 
			
				
 
	  | DeathDealer wrote: | 
	 
	
	  | sooo....meaning that rather than have them as #functions I can put them in #vars if i have them surrounded by {}'s? | 
	 
 
 
 
Never had this answered and am still wondering.
 
Also, was this #func/#var stuff correction made in the latest zmud? | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		| 
		
		 | 
	
	
		 |