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
 

Is there a more efficient way to do this.

Previous Thread :: Next Thread 
flatline115alt is not online. flatline115alt
Joined: 03 Aug 2013
Total Posts: 537
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 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
22 Sep 2013 05:04 AM
Strin should be an array, is it?
Report Abuse
flatline115alt is not online. flatline115alt
Joined: 03 Aug 2013
Total Posts: 537
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 is not online. 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 is not online. 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 is not online. 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
flatline115alt is not online. flatline115alt
Joined: 03 Aug 2013
Total Posts: 537
22 Sep 2013 05:09 AM
No. Strin should be an array, because you cannot do #of a string.
------
lol wat?
Report Abuse
flatline115alt is not online. flatline115alt
Joined: 03 Aug 2013
Total Posts: 537
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
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
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
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
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
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