lua pass by reference issue
Posted: Thu Nov 02, 2017 7:34 pm
I was under the impression that variable assignment was pass by reference for tables. However, I'm finding an issue with the following:
works properly, but the code as handled by a for loop:
fails to assign properly. Is there a way to parse through such a table without losing the reference?
Code: Select all
parse["1"]["inner"]["1"] = some_number
Code: Select all
local values = ...
for _,v in ipairs(values) do
parse= parse[v]
end
parse = some_number