Support

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

two things array/ruby related

For general discussion related FlowStone

Re: two things array/ruby related

Postby trogluddite » Sun Nov 03, 2013 5:23 am

Here's a first attempt at a more modular approach...
2D Arrays 001.fsm
(3.38 KiB) Downloaded 762 times

There's a new Ruby class "Array2D" hidden away inside a small module, but I've tried to make it so that it can be "talked to" with relatively simple commands, and won't need fiddling with.
The main "mothership" module needs a lot of work still - green String/Array inputs etc. with "set row", "insert column" etc. triggers to make it like the green Array prim's. But the code in the little "breakout boxes" makes access relatively simple now.
I've tried to make the main array behave similarly to green arrays where possible - the array "grows" in the same way, without leaving 'gaps' in the data that return nonsense values. By choosing an appropriate "default" value, you can choose whether the input data is treated as Integer or Float numbers. or Strings.
If you get a Ruby error at load time, it's because I haven't added any "protection" yet - editing the input string box should make it go away.

NB) The rule with Ruby class modules is simple, but can be awkward to get right. When FS starts up, it scans through primitives and modules in the order that you added them. So to be sure of Classes getting loaded correctly they need to be inside the first module placed into the schematic. Sometimes, the only way to do this is to put the Class module into an empty schematic, and then copy/paste everything else in there.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: two things array/ruby related

Postby tester » Sun Nov 03, 2013 1:15 pm

Thanks for working on that one. :-) Will be useful for various tasks. Although it works... strange or not working? Need to check why/what. Looks that devs have a lot of work to do, before ruby modules becomes user friendly.

As for ruby class modules and their awkwardness. Shouldn't be there some way to "retrigger" them (like the afterload primitive is used), to get the correct order? Or question to devs: wouldn't be appropriate to add some "mark" that would determine which ruby modules are loaded before other ruby parts start?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: two things array/ruby related

Postby billv » Sun Nov 03, 2013 9:56 pm

trogluddite wrote:Here's a first attempt at a more modular approach...

Wow...lot of work here Trog..thanks for the effort and time spent...
Looks like a great approach......will have to study a bit....
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 75 guests