This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Neywiny's profile picture

help with train station string splitting

Started by Neywiny, 02 July 2014 - 05:07 PM
Neywiny #1
Posted 02 July 2014 - 07:07 PM
I have a string for a small project that's a number and when transmitted the other computer receives it as 'number.0' like 1.0, 2.0,3.0,4.0. It should receive 4 numbers as just the numbers for a 16-track train station.

^that's a rough representation of it, with blue being outgoing lines and green being bridges. the yellow are computers, the redstone looking one is the master receiver, which I always use to debug rednet and receives all transmissions. Anyways, I currently need help on finding out how to separate a string at the ".". I can do it with gmatch at any spaces, but need to know how to split a string.

EDIT: I guess what I'm really asking for is if anybody knows the %a+ and %w+ things in list form, since nowhere else that i've seen has it
Edited on 02 July 2014 - 05:32 PM
Lyqyd #2
Posted 02 July 2014 - 07:16 PM
You really should have posted the code, but I suspect that if you tostring the number before writing it to the screen, it will display as you desire.
Neywiny #3
Posted 02 July 2014 - 07:36 PM
I thought about posting the code, but it's pretty much useless since all I need is one line of help and nothing is directly wrong with the code. I'll try the tostring when I have the time but my dug just cut her foot so that happened. probably within an hour i'll test it
Neywiny #4
Posted 02 July 2014 - 08:28 PM
It works on the receiving end, but as one might know it'd be better if the transmitter could just do it