View Single Post
  #1  
Old 06-22-2006, 11:43 AM
JustBreathe JustBreathe is offline
Registered User
Join Date: Jun 2006
Posts: 59
JustBreathe is on a distinguished road
Array External Return

PHP Code:
NPC1:
function 
onCreated()
  {
  echo( 
getArray() ); // Echos 1,2,3
  
}

public function 
getArray()
  {
  
temp.var = {1,2,3};
  return 
temp.var;
  } 
PHP Code:
NPC2:
function 
onCreated()
  {
  echo( 
NPC1.getArray()) ; // Echos 0
  

Inconsistency in return due to temp variables over external function.

Temp Fix:

PHP Code:
public function getArray()
  {
  
temp.var = {1,2,3};
  
this.toreturn temp.var;
  return 
this.toreturn;
  } 
Reply With Quote