MM233
|
  |
| Joined: 19 Jun 2008 |
| Total Posts: 925 |
|
|
| 03 Apr 2015 03:06 PM |
Honestly, I have no idea what's going wrong here:
local save_id = "save[Test]" local _, _, server_id = string.find(save_id, "save[(%.+)]") print(server_id)
Prints "nil", even though it should be printing "Test". |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 03 Apr 2015 03:10 PM |
wot is dis + & % junk I dun comprende, I remembr when strings were strings, and nawt sign & character jibberish
;-;-;-;-;-;-;-; |
|
|
| Report Abuse |
|
|
MM233
|
  |
| Joined: 19 Jun 2008 |
| Total Posts: 925 |
|
|
| 03 Apr 2015 03:11 PM |
| http://wiki.roblox.com/index.php?title=String_patterns#Character_Classes |
|
|
| Report Abuse |
|
|
Froast
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 3134 |
|
|
| 03 Apr 2015 03:11 PM |
The reason is because brackets are actually a part of patterns, in order to interpret them literally you have to append them with "%".
local save_id = "save[Test]" local _, _, server_id = string.find(save_id, "save%[(.+)%]") print(server_id)
Also, for this I feel like string.match is more appropriate.
local save_id = 'save[Test]' local server_id = save_id:match'save%[(.*)%]' |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2015 03:11 PM |
http://wiki.roblox.com/index.php?title=String_patterns#string.match
Here ye go
~Commands? Commands. www.roblox.com/Admin-item?id=232183441 |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 03 Apr 2015 03:13 PM |
danke MM bb, I now kn0w h0w 2 find whitespace st00f
xdd |
|
|
| Report Abuse |
|
|
MM233
|
  |
| Joined: 19 Jun 2008 |
| Total Posts: 925 |
|
|
| 03 Apr 2015 03:15 PM |
| @Froast: Yeah, I was wondering about that. Thanks. |
|
|
| Report Abuse |
|
|