174 posts
Posted 23 April 2014 - 07:21 PM
Is there a way that you can edit the value for a specific key in a table?
For example would this work?
local Status = {}
Status["Front"] = "Locked"
-- do stuff
Status["Front"] = "Unlocked"
Edited on 23 April 2014 - 05:29 PM
91 posts
Posted 23 April 2014 - 07:30 PM
Simply assign it value.
local table = {"one", "two", "three"}
print(table[2]) --> two
table[2] = "not two"
print(table[2]) --> not two
edit: Was typing this up as you edited your post. Yes, that works.
Edited on 23 April 2014 - 05:31 PM
8543 posts
Posted 23 April 2014 - 07:31 PM
Yep. Since your key is a string literal without unusual characters or spaces, you could also use: Status.Front = "Locked"
174 posts
Posted 23 April 2014 - 07:32 PM
Simply assign it value.
local table = {"one", "two", "three"}
print(table[2]) --> two
table[2] = "not two"
print(table[2]) --> not two
edit: Was typing this up as you edited your post. Yes, that works.
Alright. Wasn't sure it would work. :)/>