Arrays as parameters in AddMethod

edited 3:55AM in FastScript
OK, I'm stuck again. How do you pass an array as a function parameter. From all the pascal samples I've read it looks like this is how:

fsScript1->AddMethod("function FUNC(x:array[1..10] of Integer) : void",ScriptFunction,NULL,NULL);

But, if I step through the code, when it get to this line the app just freezes.

Anyone know the correct way to do it?

Comments

  • edited 3:55AM
    Correct is:
    fsScript1->AddMethod("procedure FUNC(x:array)",ScriptFunction,NULL,NULL);
  • edited 3:55AM
    I'm assuming that since you don't indicate a type it is a Variant by default?
  • edited 3:55AM
    yes, it is.
  • edited 3:55AM
    Is it passed as a pointer or as static? I tried to set a value from my handler function but didn't get back what I thought:

    //in my handle function I do this:

    .....

    Variant v;
    v=Params.GetElement(4);
    int i=99;
    v.PutElement(&i,0);

    ........

    //in script

    {
    int x[5];

    FUNC(x);

    showmessage(x[0]);

    }


    But I don't get 99 I get 0
  • edited 3:55AM
    Type-o I meant

    v=Params.GetElement(0);

Leave a Comment