Jump to content

Scripting Arrays


Nico D.

Recommended Posts

Hi,

Im reading about Houdini's expressions, and reading the reference I cannot find  an array data type...

I found a Vector() function that creates an array of floats, but How to create an array of strings  ?  <_<

22112[/snapback]

I'm afraid not. If your strings have no spaces in each token, then you can use one long string and pull out an "element" using arg().

Hscript has about the same power as CShell. If you need something more powerful, it's suggested that you go out to Java, Python or PERL.

Hope this helps,

Jason

Link to comment
Share on other sites

I'm afraid not. If your strings have no spaces in each token, then you can use one long string and pull out an "element" using arg().

Hscript has about the same power as CShell. If you need something more powerful, it's suggested that you go out to Java, Python or PERL.

Hope this helps,

Jason

22113[/snapback]

THANKS Jason,

For now I will use arg().

Not the best, but I can extract words from my string.

( I hope Houdini implements arrays in next versions...)

Link to comment
Share on other sites

Hi,

Im reading about Houdini's expressions, and reading the reference I cannot find  an array data type...

I found a Vector() function that creates an array of floats, but How to create an array of strings  ?  <_<

22112[/snapback]

There's an arcane form of variable expansion which can be used to simulate arrays.

for i = 1 to 10
   set var$i = `rand($i)`
end

for i = 1 to 10
   echo ${var$i}
end

The contents of the {} are expanded and used to form the variable name for the other $ expansion.

This is in hscript of course... You might be able to use these in expressions, though probably in a limited sort of fashion.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...