Difference between revisions of "Studio:How do I access an array in the parameter list through Perl?"
Line 14: | Line 14: | ||
</source> | </source> | ||
− | Another option is to use | + | Another option is to use SafeArray to directly copy a Perl array into an array of the parameter list. Here is an example: |
<source lang="perl"> | <source lang="perl"> | ||
my @a = (11, 12, 13, 14, 15, 16, 17, 18, 19, 20); | my @a = (11, 12, 13, 14, 15, 16, 17, 18, 19, 20); |
Revision as of 13:27, 8 October 2008
By using a simple interface such as:
void test1(char s[10]);
#pragma scl_function(test1)
The following Perl script example illustrates how to access an array in the parameter list. The following example sets element 0 of s to 15.
my $test = $ascript->Functions->Item("test1")->User;
my $data = $test->ParameterList;
$data->SetProperty("s", 0, 15);
$test->Call();
Another option is to use SafeArray to directly copy a Perl array into an array of the parameter list. Here is an example:
my @a = (11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
$user->ParameterList->a->{SafeArray} = \@a;
$user->Call();