Arrays as parameters in AddMethod

edited 2:51AM 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 2:51AM
    Correct is:
    fsScript1->AddMethod("procedure FUNC(x:array)",ScriptFunction,NULL,NULL);
  • edited 2:51AM
    I'm assuming that since you don't indicate a type it is a Variant by default?
  • edited 2:51AM
    yes, it is.
  • edited 2:51AM
    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 2:51AM
    Type-o I meant

    v=Params.GetElement(0);

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.