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 Patterns

Previous Thread :: Next Thread 
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
18 Jan 2013 06:36 PM
local pattern = "."
local b = {}
local message = "My Name Is IamAweome777"
for a in message:gmatch(pattern) do
table.insert(b, a)
end
print(unpack(b))


So, it's supposed to get every character in the string 'message' and insert them into a talbe. But, it doesn't insert spaces ( ).

How would I do this?
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
18 Jan 2013 06:38 PM
Spaces should be matched by '.'
Possibly you're just not seeing the spaces because of how the output is formatted?
Your code appears to work. I'm assuming that's the issue.
Report Abuse
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
18 Jan 2013 06:40 PM
Well, if I print it in the output I don't see any spaces. But that might only be how the unpack function returns the table. I'll see if there is a difference if I put it into a message/hint.
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
18 Jan 2013 06:41 PM
The output is an HTML document.
It renders consecutive whitespace characters as a single space.
Try using
print(table.concat(b,","))
Report Abuse
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
18 Jan 2013 06:44 PM
Oh ok. Thanks. I fixed it anyway with this:

local m = Instance.new("Hint",Workspace)
local pattern = "."
local b = {}
local message = "My Name Is IamAwesome777"
for a in message:gmatch(pattern) do
m.Text = m.Text..a
end


lol I had a typo in my name in the string.
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