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 » Scripting Helpers
Home Search
 

Grabbing integers from strings (names)

Previous Thread :: Next Thread 
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
26 Dec 2013 02:25 PM
So say I had a model with parts names

P1, P2, P3, P4, P5.... etc

How would I index the integer (the "1" in P1) via script?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Dec 2013 02:27 PM
Just use basic string patterns or if it's all going to start with P, just do:
blah:sub(2)
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
26 Dec 2013 02:35 PM
string:sub(int)
or
string.sub(int)?
I'm guessing the first returns it but the latter changes it?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Dec 2013 02:37 PM
No, none of them change it, to change it you do.

int = int:sub(etc)
or

int = string.sub(int, etc)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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