|
| 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 |
|
|
| |
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 05 Aug 2017 05:24 PM |
Like a dictionary?
table['text'] = 'hi' |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 05 Aug 2017 05:24 PM |
local mytable = {} mytable["Text"] = "hi"
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
| |
|
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 |
|
|
|
| 05 Aug 2017 06:07 PM |
So doing what they said actually adds the value into the table?
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
|
| 05 Aug 2017 06:16 PM |
Is there a way to remove a value from a dictionary?
|
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
| |
|
| |
|
| |
|