Skip to content

Conversation

Ramilito
Copy link
Owner

@Ramilito Ramilito commented Aug 12, 2024

#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.

@Ramilito Ramilito merged commit c27630b into main Aug 12, 2024
1 check passed
@Ramilito Ramilito deleted the fix/manipulate_copy_instead_of_original branch August 12, 2024 20:55
@mosheavni
Copy link
Collaborator

sorry!

@Ramilito
Copy link
Owner Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants