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: Can you insert many strings into one table at once?

Previous Thread :: Next Thread 
Born2Script is not online. Born2Script
Joined: 23 Jul 2013
Total Posts: 2670
09 Jun 2015 08:54 AM
an example would be: "table.insert(var, "Hello", "My", "Name", "Is", "?")"
if it doesn't, then is there any other way of doing it with only one line of code?
Thanks.
Report Abuse
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
09 Jun 2015 08:55 AM
you already did it
Report Abuse
Born2Script is not online. Born2Script
Joined: 23 Jul 2013
Total Posts: 2670
09 Jun 2015 08:56 AM
oh ok thanks
Report Abuse
Born2Script is not online. Born2Script
Joined: 23 Jul 2013
Total Posts: 2670
09 Jun 2015 08:57 AM
Players.Player.Backpack.LocalScript:26: wrong number of arguments to 'insert'
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
09 Jun 2015 09:05 AM
Yeah, you can't do it like that. You can make a function for it if you want.

local insert = function(Table, ...)
for i, v in pairs({...}) do
table.insert(Table, v)
end
end




insert(Table, "hi", 2, false, "no")
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
09 Jun 2015 09:06 AM
Sort of.

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

setmetatable(a, {
__concat = function(self, other)
for i, v in pairs(other) do
table.insert(self, v)
end
return self
end})

a = a..({"d", "e", "f"})
Report Abuse
anaIyze is not online. anaIyze
Joined: 29 May 2014
Total Posts: 2048
11 Jun 2015 11:55 PM
var={};
table.insert(var,{Hello='Hello';My='My';Name='Name';Is='Is';['?']='?';});
print(var.Hello,var.My,var.Name,var.Is,var['?']);
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Jun 2015 11:57 PM
-.-
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