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: Table Manipulation

Previous Thread :: Next Thread 
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 05:17 PM
How would I insert something like: Text = "Hi" into a table?

I tried:


local mytable = {}
table.insert(mytable, Text = "Hi")


but that doesn't work.


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 05:22 PM
b


Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
05 Aug 2017 05:24 PM
Like a dictionary?

table['text'] = 'hi'
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
05 Aug 2017 05:24 PM
local mytable = {}
mytable["Text"] = "hi"



Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 05:25 PM
No i need a function which adds it in when something specific happens.
So the final table would be:

mytable = {Text = "Hi"}


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 05:34 PM
b


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 06:03 PM
bump


Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
05 Aug 2017 06:03 PM
You already got 2 answers so I don't see why you keep bumping the thread


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 06:07 PM
So doing what they said actually adds the value into the table?


Report Abuse
ReallyExpensive is not online. ReallyExpensive
Joined: 01 Apr 2013
Total Posts: 951
05 Aug 2017 06:10 PM
Essentially, it makes a value equal something

local tab = {}

By doing:

tab['Text'] = "hi"

This changes 'tab' to:

tab = {

["Text"] = hi,

}

So now you can do:

#code print(tab.Text)
#code -- > hi


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 06:12 PM
Brilliant, thank you.



Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 06:16 PM
Is there a way to remove a value from a dictionary?


Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
05 Aug 2017 06:17 PM
Set its value to nil


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
05 Aug 2017 06:17 PM
Thank you


Report Abuse
YoBoiDevDerpy is not online. YoBoiDevDerpy
Joined: 05 Feb 2011
Total Posts: 3020
05 Aug 2017 06:23 PM
or table.remomve
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