Reputation: 4472
I'm new to Lua so please bear with this simple question :)
I'm simply trying to iterate over a table, and modify it's values. however, it seems I can't modify directly the "value" part?
code:
for id,value in pairs(some_table) do
value = value * some_math_here
end
will i actually need to modify some_table[id] instead, or is there a more elegant way?
Upvotes: 3
Views: 203
Reputation: 18139
You will actually need to modify
some_table[id]
instead. value does not actually represent some_table[id]
Upvotes: 6