badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Jan 2016 01:08 PM |
I have a 5x5 grid of tiles named in numerical order like this:
1 1, 2 1, 3 1, 4 1, 5 1,
and so on until 25. The second number is the row the tile is in, 25 will be 25 5 since it's on row 5.
I need to get the tiles around a certain tile and I am doing this by taking off numbers from the name, I need to use string.sub to separate the numerical number from the row number (separate 2 from 1 or 25 from 5 since 25 will be on row 25)
the problem with this is that I need to get the first 2 numbers for tiles which their numerical order is more than 1 digit and only the first number for tiles which their numerical is only 1 digit. How can I get all the characters before a whitespace since the numerical order and row number are separated by a space?
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
BanTech
|
  |
| Joined: 31 Dec 2015 |
| Total Posts: 886 |
|
|
| 14 Jan 2016 01:12 PM |
| Simple fix: 01 01, 02 01 ... |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Jan 2016 01:14 PM |
What?
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
BanTech
|
  |
| Joined: 31 Dec 2015 |
| Total Posts: 886 |
|
|
| 14 Jan 2016 01:16 PM |
| Make everything two digits..... |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Jan 2016 01:17 PM |
yeah you have no idea what I'm doing
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|
nox7
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 27467 |
|
|
| 14 Jan 2016 01:19 PM |
"yeah you have no idea what I'm doing"
While his solution isn't what you may have been looking for, it is correct and probably one of the easier solutions to your issue. |
|
|
| Report Abuse |
|
|
BanTech
|
  |
| Joined: 31 Dec 2015 |
| Total Posts: 886 |
|
|
| 14 Jan 2016 01:20 PM |
| I do, but if you have no idea of the string functions then why not make it all two digits to help you? You can get the numbers without having to worry where the whitespace is |
|
|
| Report Abuse |
|
|
BanTech
|
  |
| Joined: 31 Dec 2015 |
| Total Posts: 886 |
|
|
| 14 Jan 2016 01:21 PM |
| If you want to find the whitespace indexes, look around the string manipulation on the wiki. string.find and string.gmatch are good places to start. |
|
|
| Report Abuse |
|
|
badfitz67
|
  |
| Joined: 03 Jun 2010 |
| Total Posts: 13165 |
|
|
| 14 Jan 2016 01:21 PM |
forget it
You're a blunt tool, old man. |
|
|
| Report Abuse |
|
|