Hi!
I'm attempting to change a value in a table. My code is as follows:
local data = {
Apple = false,
Inside = {
Value = 123
}
}
-- valueChanging is something such as "Apple" or "Value" inside of "Inside"
-- newValue is what the value will become.
local changeData = function(valueChanging, newValue)
data[valueChanging] = newValue
end
changeData("Inside.Value", 424) -- DOES NOT WORK
changeData("Apple", true) -- DOES WORK
I definitely know that the problem is something to do with the 2nd argument with the changeData function but I'm not sure how to solve it! I am really concerned about the "Table.Value" being the cause of the problem.
The worst thing is is that when you run this code, there are NO ERRORS. I am super confused.
Any help?
Thanks! Nathan.

1 comment
Ah yes, I see what the problem is. I guess I can use a triplet to add additional indexes. Thank you very much for your help! :D