accessing array from different wrangle

   215   3   1
User Avatar
Member
79 posts
Joined: Feb. 2016
Offline
wrangle one:

int @number[];

@number=array(1,2,3,4,5);

wrangle two:

i@value = @number[1];

it won't allow it even though the array is a variable. How?
Edited by ouroboros1221 - Feb. 4, 2019 20:56:11
User Avatar
Member
2882 posts
Joined: Sept. 2011
Offline
Is the prototype
int @number[];
in the second wrangle too?
User Avatar
Member
79 posts
Joined: Feb. 2016
Offline
no, it's been declared in the first wrangle, so I thought I won't need to. But your answered solved the issue xD
Edited by ouroboros1221 - Feb. 4, 2019 21:47:00
User Avatar
Member
2882 posts
Joined: Sept. 2011
Offline
The prototypes are how the compiler knows which type of variable to bind.

In wrangles you can either use prototypes or a decorator before the ‘@’ symbol to specify the bound type.

For example:
v@fooor vector @foo;, i[]@myarror int @myarr[];, p@baror vector4 @bar;
All of the different type decorators are found in the help for wrangles.
  • Quick Links