If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Ruby - What's the best way to create a 3-dimensional array?
3 posts
• Page 1 of 1
Ruby - What's the best way to create a 3-dimensional array?
Hi guys,
I'm new to ruby and flowstone and I want to know what's the best methods for creating a 3-dimensional array, I've seen some different methods online and thought I'd better get your input on that.
The array dimensions are: 25, 3, 5 (not that it matter so much )
thx i advance for the help.
also: I had a problem with the knobs. when I take a knob and connect its output to ruby input it the corresponding value inside the ruby module doesn't update when I turn the knob around. how can I solve this?
I'm new to ruby and flowstone and I want to know what's the best methods for creating a 3-dimensional array, I've seen some different methods online and thought I'd better get your input on that.
The array dimensions are: 25, 3, 5 (not that it matter so much )
thx i advance for the help.
also: I had a problem with the knobs. when I take a knob and connect its output to ruby input it the corresponding value inside the ruby module doesn't update when I turn the knob around. how can I solve this?
- zoobooboozoo
- Posts: 32
- Joined: Tue Sep 23, 2014 12:14 pm
Re: Ruby - What's the best way to create a 3-dimensional arr
zoobooboozoo wrote:I'm new to ruby and flowstone and I want to know what's the best methods for creating a 3-dimensional array, I've seen some different methods online and thought I'd better get your input on that.
Nesting blocks is a comfortable way to create multi-dimensional arrays:
- Code: Select all
a3d = Array.new(4) {Array.new(3) {Array.new(2)} }
Accessing that array's cells is also straight-forward:
- Code: Select all
a3d[0][1][1] = 5
n = a3d[2][0][0]
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Ruby - What's the best way to create a 3-dimensional arr
Thanks, works great.
- zoobooboozoo
- Posts: 32
- Joined: Tue Sep 23, 2014 12:14 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 65 guests