|
| 10 Apr 2017 02:38 PM |
| Is there a way to edit strings in code with string patterns? |
|
|
| Report Abuse |
|
|
Inductive
|
  |
| Joined: 28 May 2012 |
| Total Posts: 6480 |
|
|
| 10 Apr 2017 02:40 PM |
| Google search "Roblox strings" real quick. |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Apr 2017 02:45 PM |
| Can you elaborate on those answers? |
|
|
| Report Abuse |
|
|
devHoodie
|
  |
| Joined: 04 Nov 2008 |
| Total Posts: 30332 |
|
|
| 10 Apr 2017 02:46 PM |
http://wiki.roblox.com/index.php?title=Global_namespace/String_manipulation
r+://487783315r+://467523707r+://215869124 |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 02:47 PM |
@Prestigious
Loadstring turns a string into a lua function and then run it. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 02:50 PM |
msg = "print(3)" f = loadstring(msg)
f() --> 3 |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 02:51 PM |
| The only thing I found on that wiki page that had anything to do with string patterns is match, gmatch, and gsub. None of the three have to do with directly editing the strings. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 02:51 PM |
| "msg = "print(3)" f = loadstring(msg) ### ### ## #### proves nothing. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 03:00 PM |
For example, could you do something like this:
local string = "1a"
string:Reformat("%l%d")
print(string)
output:
>a1 |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 03:03 PM |
When was Reformat a thing.
#code print(string.rep("Lit",5)) |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 03:06 PM |
| It's not, I was just giving a general idea of what I'm looking for |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2017 03:06 PM |
| Reformat doesn't exist in lua. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 11 Apr 2017 02:47 PM |
Yes, there's a way... how is this even a question? Assign the variable to a the return value of a string function.
|
|
|
| Report Abuse |
|
|
|
| 11 Apr 2017 02:51 PM |
| @Unsub How would you use a string pattern? |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Apr 2017 02:55 PM |
Something like this
string:Reformat("%d%l")
(I know reformat isn't a function, it's just to give you an idea) |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2017 02:56 PM |
What are you trying to do?
|
|
|
| Report Abuse |
|
|
|
| 11 Apr 2017 02:58 PM |
| Change the string using string patterns. string = #### #################### The match function would return a2. string = #### ####################### Is there a function that would return 2a? |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Apr 2017 03:02 PM |
| Hash 1: "a2" string:match("%l%d"). |
|
|
| Report Abuse |
|
|
| |
|