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 » Scripters
Home Search
 

Re: Converting a table into a string of words

Previous Thread :: Next Thread 
xBlueSparks is not online. xBlueSparks
Joined: 04 Feb 2013
Total Posts: 606
02 Feb 2017 10:04 AM
table = {"Hey","How","Are","You?"}


Instead of:

for i,v in pairs(table) do
print(v)
wait()
end

How can I print them all together like: "Hey How Are You?"

I'd like to put it in a variable somehow.


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Feb 2017 10:04 AM
table.concat(tab,' ')


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Feb 2017 10:05 AM
What are you doing this for those? If this is for saving data then you are doing it wrong.


Report Abuse
xBlueSparks is not online. xBlueSparks
Joined: 04 Feb 2013
Total Posts: 606
02 Feb 2017 10:07 AM
I'm not saving data. I'm using WebHook on discord. It's just I had to take out words because inside of a table I had number values.


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Feb 2017 10:07 AM
ok


Report Abuse
xBlueSparks is not online. xBlueSparks
Joined: 04 Feb 2013
Total Posts: 606
02 Feb 2017 10:08 AM
You saved me a load of trouble. Thanks!


Report Abuse
Milenveliki is not online. Milenveliki
Joined: 14 Aug 2013
Total Posts: 1097
02 Feb 2017 10:11 AM
tabble={"Hey","How","Are","You?")
zomg=''
for i,v in pairs(tabble)do
zomg=zomg..v..' ';end
print(zomg)
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
02 Feb 2017 11:16 AM
print(unpack(table))
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Feb 2017 11:35 AM
Why do people post such idiotic and/or wrong solutions after someone posted the correct one? I never understood that about this subforum...
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
02 Feb 2017 05:13 PM
Theres a function called unpack which prints the contents of a tableyou idiot.

"Wrong solution"

Lmao
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Feb 2017 05:15 PM
"Theres a function called unpack which prints the contents of a tableyou idiot."
Wrong, that's not what unpack does. Nice job calling me an idiot my dear insecure skid.

And time's solution is far better than using yours lmao.
Report Abuse
ray_revenge is not online. ray_revenge
Joined: 18 Feb 2011
Total Posts: 453
02 Feb 2017 05:17 PM
"I'd like to put it in a variable somehow. "
unpack does not do that
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
02 Feb 2017 05:18 PM
lemme just repeat what you said

"Wrong solution"

I was just giving another way of doing it.

now dont waste my time
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
02 Feb 2017 05:18 PM
^

Never call cntkillme stupid
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
02 Feb 2017 05:22 PM
Because doing dumb stuff is fun, cnt.

local strings = {"a", "b", "c", "d"}

setmetatable(strings, {
__call = function(self, ...)
return string.concat(self) .. string.concat({...})
end
})

Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Feb 2017 06:40 PM
"lemme just repeat what you said
'Wrong solution'
I was just giving another way of doing it."

Your way sucks and doesn't solve OP's "I'd like to put it in a variable somehow." so yes, in that regard it's WRONG.

@cody
hello icyfires
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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