Quote:
Originally Posted by Inverness
onCreated does not work like this 
|
PHP Code:
public function newInstance( param, objectName )
{
if ( objectName != "" )
if ( (@ objectName ).type() == 2 )
(@ objectName ).destroy();
// Initialize Class
if ( objectName == "" )
temp.newInstance = new TStaticVar();
else temp.newInstance = new TStaticVar( @objectName );
temp.newInstance.class = this;
temp.newInstance.join( ("class_"@ this.name).lower() );
// Initialize Object
if ( this.name in temp.newInstance.getfunctions() )
temp.newInstance.(@ this.name )( param );
return temp.newInstance;
}

I made a turnaround for that onCreated problem. Basically, the newInstance() would call the constructor for the class ( thus, TNode )
PHP Code:
public function TNode() { foo; }
Makes sure that the initialize variables are initialized immediately.
Such as:
PHP Code:
function onCreated()
{
array = TMap.newInstance( {{"Test3", "333"}} );
array.put("Test", 123);
array.put("Test2", 123);
array.put("Test", 321);
echo( array.toString() ); // output: "Test3,333","Test,321","Test2,123"
}
EDIT: I'm thinking of having an inheritance system working out... So one could probably do an object.class.instanceof( otherclass )... Something along the lines of:
PHP Code:
public function instanceOf( class )
{
if ( this == class )
return true;
// for ( superClass: superClasses )
// if ( superClass.instanceOf( class ) )
// return true;
return false;
}