View Single Post
  #11  
Old 06-16-2007, 09:04 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
TGraalVar Types:
0 = Numeric
1 = String
2 = Object
3 = Array

As you can see, Objects and Arrays aren't quite the same.
The only reason the second part worked is because you initialized test2 before trying to add to it, I don't see this for the first part.

Arrays themselves are a type of object (TGraalVar) so I see no reason why you need to make it an object beforehand. Just make sure its initialized 'varname = 0;' will do the trick.

Here is an example that works:
PHP Code:
function onCreated() {
  
temp.object 0;
  
temp.array = 0;
  
  
object = new TStaticVar();
  
object.testvariable "ZOMG!";
  
  array.
add(object);
  echo(array[
0].testvariable);

Edit: Let me correct my statement, you're messing up somewhere because I know that variables are automatically initialized if Graal can't find one for what you're trying to do.
PHP Code:
function onCreated() {
  
temp.object 0;
  
//temp.array = 0;
  
  
object = new TStaticVar();
  
object.testvariable "ZOMG!";
  
  
temp.array.add(object);
  echo(array[
0].testvariable);

Stop trying to make me doubt my knowledge -.-
__________________
Reply With Quote