|
| 20 Jun 2015 05:49 AM |
local text = [[
]];
local k = 0;
for i in text:gmatch("%s+") do k = k + 1; end;
print(k); -- it returns 1 |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 05:55 AM |
There's no text in it...
Try this out:
local text = [[ ]]
local s = 0
for a in text:gmatch("%s+") do s = s + 1 end
print(s) |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Jun 2015 05:57 AM |
| You don't have any spaces in yours. You just pressed enter a couple times. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 05:58 AM |
| this text is going to be textbox with multiple lines will it work ther ? |
|
|
| Report Abuse |
|
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 20 Jun 2015 06:14 AM |
| \n and whitespaces are two different things my friend. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 06:22 AM |
This one is an easy one.
Use...
str:gmatch("[^/n/r]+") |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Jun 2015 06:29 AM |
| checks from the beginning of a string |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 06:37 AM |
I'm pretty sure when it's used in a set, it means "Not containing" http://wiki.roblox.com/index.php?title=String_pattern#Complements |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
| |
|
|
| 20 Jun 2015 08:00 AM |
@eLune I write in java and am constantly changing paths from \ to / :) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 20 Jun 2015 11:17 AM |
| The escape is still \n and \r in Java. |
|
|
| Report Abuse |
|
|