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
 

Re: Help with char to string.

Previous Thread :: Next Thread 
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
21 Aug 2011 12:56 AM
tab = {72, 101, 108, 108, 111, 95, 87, 111, 114, 108, 100}
for i = 1, #tab do
print(string.char (tab[i]))
end

How would I print all of this on one line?

It prints the characters going down...
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
21 Aug 2011 01:02 AM
Bump
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
21 Aug 2011 01:14 AM
Isn't it string.byte for number to string?
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
21 Aug 2011 01:21 AM
string.char() changes a number into a string.
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
21 Aug 2011 01:38 AM
Well this is how I can do it:
tab = {72, 101, 108, 108, 111, 95, 87, 111, 114, 108, 100}
print(string.char (tab[1],tab[2],tab[3],tab[4],tab[5],tab[6],tab[7],tab[8],tab[9],tab[10],tab[11]))

Is there any other way I could do it in one line without repeating "tab[number]" ?
Thanks.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
21 Aug 2011 01:44 AM
tab = { watever }
str = ""
for i = 1, #tab do
str = str .. string.char(tab[i])
end
print(str)

or in normal lua, i think you can use io.write so it doesn't add any newlines

-Like a boss.
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
21 Aug 2011 02:34 AM
Thanks a ton! It prints "Hello_World" if you were wondering. :P
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
21 Aug 2011 02:34 AM
i wasn't

-Like a boss.
Report Abuse
superior is not online. superior
Joined: 13 Apr 2008
Total Posts: 1662
21 Aug 2011 02:35 AM
Gee... You don't have to be harsh about it. D: I was just saying...
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