generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Get all characters before whitespace in string

Previous Thread :: Next Thread 
badfitz67 is not online. 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 is not online. BanTech
Joined: 31 Dec 2015
Total Posts: 886
14 Jan 2016 01:12 PM
Simple fix: 01 01, 02 01 ...
Report Abuse
badfitz67 is not online. 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 is not online. BanTech
Joined: 31 Dec 2015
Total Posts: 886
14 Jan 2016 01:16 PM
Make everything two digits.....
Report Abuse
badfitz67 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image