|
| 13 Oct 2015 09:01 AM |
With things like creating admin commands, I always run into problems with commands such as teleport. For instance, I'll have something like this to find things.
if m:sub(1,4) == Prefix.. "tp " then local startplr = findPlr(m:lower():sub(5)) local newplr = findPlr(m:lower():sub(7)) startplr:MoveTo(findplr.Torso.Position) end
Now, of course, that isn't what I'm going to actually use but it does use the same methods as I would normally use. 5 is where the first name would be and 7 is where the next name would be. But, for some reason, it never works like that so I'm assuming that I'll have to use something else with the sub to find the second name. What could I use to accomplish this? |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2015 09:04 AM |
| http://wiki.roblox.com/index.php/String_pattern |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2015 09:05 AM |
| I don't see how string patterns would help much at all, other than eliminating the spaces. |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2015 09:10 AM |
| It's easy I'll post solution in like 20 mins when im home |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 13 Oct 2015 09:24 AM |
I'm using this
function getArgs(str,char) local args = {} for S in str:gmatch("[^"..char.."]+") do table.insert(args,S) end return args end
a friend of mine quickly made it because I don't understand string patterns at all |
|
|
| Report Abuse |
|
|