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 » Game Design
Home Search
 

Re: How to insert Dictionaries into Tables?

Previous Thread :: Next Thread 
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 06:20 PM
So, I have a table that looks like this:

local Mytable ={
["Money"] = 500,
[Inventory] ={
["Bread"] = 1,
["Apples"] = 40,
},
}

So i'm trying to insert another Dictionary like this:
["Pets"] ={
["Dogs"] = 1,
["Cats"] = 5,
},

But how would I inset that Dictionary into Mytable? I already tried : table.insert(Mytable,["Pets"] ={
["Dogs"] = 1,
["Cats"] = 5,
},)

But that didn't work... Anyone know how to do this?
(I already checked the Wiki, it didn't help)
Report Abuse
DivisionTalk is not online. DivisionTalk
Joined: 29 Jul 2011
Total Posts: 562
07 Feb 2017 06:28 PM
throw the webster dictionary at it
Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
07 Feb 2017 06:38 PM
table[Whatever] = "Something" should work.

Table.insert won't work unless it's already defined as a dictionary.
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 06:50 PM
So that inserts the dictionary into the table?
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 07:03 PM
@Inductive that didn't work...
Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
07 Feb 2017 07:30 PM
It should work. tab["Whatever"] = 2

Worked for me, at least.
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 07:31 PM
Is that inserting it via Script?
Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
07 Feb 2017 07:35 PM
Are you trying to insert the entirety of a table, or just the values of a table?
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 07:37 PM
Okay so, I have a table, And i'm trying to make a script insert a Dictionary into my table.
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 08:15 PM
Bump
Report Abuse
GearMechs is not online. GearMechs
Joined: 01 Dec 2010
Total Posts: 1220
07 Feb 2017 08:16 PM
You could cycle a in pairs loop and add each item to the table

for i,v in pairs(whatevertable) do
table.instet(whatevertable2, v

end


Small Developer
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 08:29 PM
@GearMechs Wouldn't that insert the items at the end of the Table?
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 08:40 PM
@GearMechs I need to insert a whole Dictionary...
Report Abuse
GearMechs is not online. GearMechs
Joined: 01 Dec 2010
Total Posts: 1220
07 Feb 2017 08:49 PM
that will; set whatever table to the dictionary and whatevertable 2 to the one you are putting it in.


Small Developer
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
07 Feb 2017 08:57 PM
Wait what... Sorry, can you show me a example?
Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
07 Feb 2017 11:18 PM
Mytable[Whatever] = Othertable
Report Abuse
MRbraveDragon is not online. MRbraveDragon
Joined: 06 Jan 2013
Total Posts: 172
08 Feb 2017 10:56 AM
@Inductive. Oooh that works. I must have been doing it wrong, thank's for all the help.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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