Usage

Syntax: clearemptyvars();

Explanation

Will clear empty variables from the npc. Often when using this.getDynamicVarNames() it will return variables that have been used in the past as well as present. After calling clearemptyvars() those variables will be actually removed, and no longer listed with getDynamicVarNames() .


Example

function onCreated() {
   temp.output = {};
  
  this.test.var = "testing";
  temp.output.add( this.test.getDynamicVarNames() );
  
  this.test.var = "";
  temp.output.add( this.test.getDynamicVarNames() );
  
  clearemptyvars(); 
  temp.output.add( this.test.getDynamicVarNames() );
  
  echo( temp.output );  

}

... echos " 'var','var',' ' "
and without using clearemptyvars();,
it echos " 'var','var','var' ".

warning replacing temp.output with an echo in this example seems to crash the npc server.

Categories

CategoryFunctionClientside
CategoryFunctionServerside

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki