player
|
  |
| Joined: 04 Nov 2006 |
| Total Posts: 1053 |
|
|
| 17 Jul 2012 08:42 PM |
I am resorting to pushing tons of data inside a single string.
It includes a string, a CFrame Value, a Parent Directory, Another string, and another CFrame.
I wanted to divide them within the string through the "*" symbol.
For example:
"Ello*0,0,0,0,0,0,0,0,0*workspace.Player.Head*Blarg*0,0,0,0,0,0,0,0,0"
Is there a way I can easily search the string until it hits a "*" and then collects the according string? |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Jul 2012 08:47 PM |
Umm..
string="Cake*Cake2" local string2=string:gmatch(".+*"):gsub("*","") print(string2)
Not sure.
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2012 08:48 PM |
There's alway's the tabular way. .-.
names={} table.insert(names,"Something") print(table.concat(names," "))
:3
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
player
|
  |
| Joined: 04 Nov 2006 |
| Total Posts: 1053 |
|
|
| 17 Jul 2012 10:11 PM |
I'm looking at the string manipulation wiki, but it is not helping me much. I'm messing around with "string.find" but it isn't working like I planned. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2012 10:20 PM |
I think you might want to use string.match...
† KMXD † |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 17 Jul 2012 10:42 PM |
S = "Ello*0,0,0,0,0,0,0,0,0*workspace.Player.Head*Blarg*0,0,0,0,0,0,0,0,0" for i in string.gmatch(S, '[^%*]+') do print(i) end
>Ello >0,0,0,0,0,0,0,0,0 >workspace.Player.Head >Blarg >0,0,0,0,0,0,0,0,0
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2012 10:44 PM |
String.find
local mes = "Hi this is a string.find example" print(string.find(mess,"."))
print(string.find(mes,"g."))
Output >19, 20
String.find returns then numbers of the characters position of the first and last character of the string you wanted to find. Sorry if it is a bit confusing :3 |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2012 10:45 PM |
| Whoops did the print() two times :3 |
|
|
| Report Abuse |
|
|