generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: String changer

Previous Thread :: Next Thread 
lolb3 is not online. 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
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
12 Mar 2013 03:23 PM
:gsub provides string replacing.

str = str:gsub("Hollo","Hello")
Report Abuse
lolb3 is not online. 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
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
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 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
12 Mar 2013 03:47 PM
Heh.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>***Brain fart***
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image