|
| 22 Sep 2013 04:41 AM |
function backwards(strin) back = #strin hold = "" for i = 1, #strin do sub = strin:sub(back, back) hold = hold..sub back = back - 1 print(#hold, hold, back) end if #hold == #strin then strin = hold print(strin) end return hold end
|
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 22 Sep 2013 05:04 AM |
| Strin should be an array, is it? |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 05:06 AM |
| strin should be a string. It is my way of reversing a string without using string.reverse or :reverse().. I want to know if there is a deficiency in my code. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 22 Sep 2013 05:07 AM |
| No. Strin should be an array, because you cannot do #of a string. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 22 Sep 2013 05:08 AM |
Adept test hmm?
Let me take a look |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 22 Sep 2013 05:09 AM |
Smiley..
I dont know if...dude.
# returns the length of a string or sumtin |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 05:09 AM |
No. Strin should be an array, because you cannot do #of a string. ------ lol wat? |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 05:14 AM |
Adept test hmm? ----- No I was making a string reversal GUI. I don't take no tests. I would just send a model in instead. |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 05:20 AM |
function reverse(wholeString) if not type(wholeString) == "string" then return end local backwardsString = "" for i = #wholeString, 1, -1 do backwardsString = backwardsString..sub(wholeString, i, i) end return backwardsString end |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 05:21 AM |
function reverse(wholeString) if not type(wholeString) == "string" then return end local backwardsString = "" for i = #wholeString, 1, -1 do backwardsString = backwardsString..wholeString:sub(i, i) end return backwardsString end |
|
|
| Report Abuse |
|
|