miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 07 Aug 2011 02:18 PM |
Whats the point of strings?I mean for example lets just say I do string.rep
a=string.rep ("Blarg, ", 4) print(a) Will result in Blarg, Blarg, Blarg, Blarg, Thats what I saw on wiki.
But whats the point of say that when you can just say
print("Blarg,Blarg,Blarg,Blarg,"
|
|
|
| Report Abuse |
|
|
hikk
|
  |
| Joined: 15 Jan 2007 |
| Total Posts: 13775 |
|
| |
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 07 Aug 2011 02:22 PM |
string.rep() is only really for effects. Strings can be used for multiple things such as tournaments, easy saving, and basically anything you can imagine.
local a=Instance.new("Message",workspace); local mesl="Hello miz, so you were wondering why strings were useful I hear? Maybe this would be helpful in some way or another I hope.";
for i=1,mesl:len() do Wait(0.1); a.Text=mesl:sub(i-10>0 and i-10 or 1, i); end Wait(2); a:remove(); |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 07 Aug 2011 02:24 PM |
| Also you use strings 10x more than you think. Every time you use anything like .Name or print("Blarg,Blarg,Blarg,Blarg,") you're still using strings. You won't immediately be able to find a good use for all the string functions but trust me, later you will find them useful and you will see how many more doors it opens. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 07 Aug 2011 03:16 PM |
| Ok, so if your saying that for example .Name is a string what is that specific string called? |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 07 Aug 2011 03:17 PM |
Whatever you catch it with.
a=workspace.miz656.Name
print(a) print(a:rep(5)) |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 07 Aug 2011 03:21 PM |
I could of also said print(Whatever I want) print(ONce again whatever I want)
Can you give me another SIMPLE example why strings are important? |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 07 Aug 2011 03:25 PM |
I've already told you, even just doing what you just said is USING strings. You can't avoid using strings for these situations. If you're questioning the point of string.rep(), it doesn't have any except for decoration pretty much.
local a=Instance.new("Message",workspace) while Wait() do for i=0,5 do Wait(0.5) a.Text=("*"):rep(i) .. " hola miz " .. ("*"):rep(i) end for i=5,0,-1 do Wait(0.5) a.Text=("*"):rep(i) .. " hola miz " .. ("*"):rep(i) end end
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 07 Aug 2011 03:35 PM |
| That confuses me because I don't know why you put a multiplication sign but ok whatever. |
|
|
| Report Abuse |
|
|