lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 12 Mar 2013 03:07 PM |
| How would one set the string.sub? For instance, say I wanted to change the string "Hollo mommy whats up"'s Hollo to Hello. How would I do this Via Lua? |
|
|
| Report Abuse |
|
|
| 12 Mar 2013 03:23 PM |
:gsub provides string replacing.
str = str:gsub("Hollo","Hello") |
|
|
| Report Abuse |
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 12 Mar 2013 03:29 PM |
How would I implement that for this?
char={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} function make() for i=1,99 do string.gsub(string.sub(i,script.Parent.Text),char[math.random(1,char)]) end end string.gsub(string.sub(100,script.Parent.Text), "=")
It's not working for me. I want it to have a random string of characters in it's parent's text, then the = sign but it's not working, |
|
|
| Report Abuse |
|
|
| 12 Mar 2013 03:37 PM |
You certainly don't need any string processing for that? String.sub takes a string as its first argument, you've used numbers for both of its uses in this script..
local s = "" for i = 1, 100 do s = s .. char[math.random(1,#char)] --also note it's 1,#char, not 1,char. 'char' is a table not a number end s = s .. "=" |
|
|
| Report Abuse |
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 12 Mar 2013 03:47 PM |
Heh.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>***Brain fart*** |
|
|
| Report Abuse |
|