help ruby

For general discussion related FlowStone
Post Reply
mimine
Posts: 12
Joined: Sat Feb 09, 2013 11:47 am

help ruby

Post by mimine »

just need to simply remove a line in the list array (ruby my nightmare) :cry:
Attachments
teste teste ruby.fsm
(370 Bytes) Downloaded 962 times
User avatar
TrojakEW
Posts: 111
Joined: Sat Dec 25, 2010 10:12 am
Location: Slovakia

Re: help ruby

Post by TrojakEW »

Something like this?
Attachments
teste teste ruby.fsm
(453 Bytes) Downloaded 941 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: help ruby

Post by trogluddite »

And if you swap...
im.delete_at(<number>)
...which deletes at a soecific location.
...for...
im.delete(<string>)
You can delete an entry by its name; for example...
im.delete("lo")
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
mimine
Posts: 12
Joined: Sat Feb 09, 2013 11:47 am

Re: help ruby

Post by mimine »

thank you for the help. I changed a little, the entry number in array or text. this is exactly what I wanted. good job. ;)
Attachments
teste teste ruby.fsm
(1.39 KiB) Downloaded 938 times
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: help ruby

Post by trogluddite »

Great - glad it is now working.

A couple of little tips for the Ruby.

- The line with only "@ins[1]" is not required - using that value inside the "delete" or "delete_at" is enough to make Ruby read the value.

- When putting the values inside '(...)' it is better not to put a space between the method name and the values, e.g...
im.delete(@ins[1])
(no space follows 'delete')
Mostly, using a space is OK, but I have noticed that sometimes putting a space will give an error.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Post Reply