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: Copying Tables.

Previous Thread :: Next Thread 
Krelinos is not online. Krelinos
Joined: 09 Jan 2010
Total Posts: 425
25 Nov 2012 10:41 AM
How would I copy content from one table to another?
Report Abuse
YaYaBinks3 is not online. YaYaBinks3
Joined: 05 Jun 2009
Total Posts: 2631
25 Nov 2012 10:46 AM
    for i,v in pairs(table) do
    table.insert(othetable,v) --Clones the part into other table
    table.remove(table,i) --Removes the part you just copied
    end

>Much love, YaYaBinks3.
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
25 Nov 2012 10:47 AM
You mean indexing?

tab = {thing = 123, thing123 = "thing"}
num = tab.thing123
print(num)
> "thing"
Report Abuse
Krelinos is not online. Krelinos
Joined: 09 Jan 2010
Total Posts: 425
25 Nov 2012 10:48 AM
Alright! Thanks.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
25 Nov 2012 12:37 PM
YaYa isn't quite right.

for I, v in pairs(oldtable) do
rawset ( othertable, i, v )
end
Report Abuse
MikeAnIkes is not online. MikeAnIkes
Joined: 13 Mar 2010
Total Posts: 1581
25 Nov 2012 01:16 PM
@Firefox
I don't think someone who is asking how to index cares about metatables.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
25 Nov 2012 02:59 PM
I didn't do anything with regards to metatables ....
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
25 Nov 2012 02:59 PM
for i, v in pairs(oldtable) do
rawset ( othertable, i, v )
end



My phone auto-capitalized the i. Sorry about that.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Nov 2012 03:17 PM
You guys make me sick. Sick I say!

Why not just reference it?

tab1 = {"Hi","dude"}

tab2 = tab1

print(tab2[1])
--Hi
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
25 Nov 2012 06:30 PM
Because that does not COPY it. ^_^
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