|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|