Trouble creating array type attributes

   1299   4   0
User Avatar
Member
61 posts
Joined: Feb. 2020
Offline
I thought the syntax for creating array<type> expressions in vex went like this:
i[]@gf = array(1,2);
But that gives error:
```
"Read only expression on left side of assignment"

```
What am I doing wrong here?
User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
There's nothing wrong with your syntax. Probably the issue is the context you are working in.
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
Save, close and try restarting the houdini s3ssion..
sometimes the wrangle node is funky drunky
User Avatar
Member
8538 posts
Joined: July 2007
Offline
nothing to do with array attributes

you are trying to write to read only attribute binding

Wrangle has parameter called Attributes To Create, which is by default * therefore all attributes are writable
however if name of your @ attribute binding doesn't match the pattern in that parm you can't write to it

this may be case in some VEXpressions on POP nodes where you don't have access to Attributes To Create which is inside and is not including your attribute name
in such cases you can force it by using export keyword
export int @gf[];
i[]@gf = array(1,2);
Edited by tamte - Aug. 2, 2022 15:09:53
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
61 posts
Joined: Feb. 2020
Offline
tamte
nothing to do with array attributes

you are trying to write to read only attribute binding

Wrangle has parameter called Attributes To Create, which is by default * therefore all attributes are writable
however if name of your @ attribute binding doesn't match the pattern in that parm you can't write to it

this may be case in some VEXpressions on POP nodes where you don't have access to Attributes To Create which is inside and is not including your attribute name
in such cases you can force it by using export keyword
export int @gf[];
i[]@gf = array(1,2);


This worked for me!
  • Quick Links