Ramilito / kubectl.nvim

Apache License 2.0
165 stars 5 forks source link

fix: manipulate copy instead of original #159

Closed Ramilito closed 1 month ago

Ramilito commented 1 month ago

158 Introduced a bug since lua doesn't send tables by value and instead uses reference, that was fine when we didn't have the values stored in a variable (hardcoded parameters) but started getting corrupt when sent into a function that manipulates the input parameter.

Solved it by making copies of the arguments but the correct solution is to use immutable tables for readonly values.

mosheavni commented 1 month ago

sorry!

Ramilito commented 1 month ago

No worries! I didn't see it either! It just exposed that we aren't doing proper functional programming, which we probably should, will make an issue to create readonly tables to make sure the state doesn't get corrupt!