While working on a script which needs a location i update an a location to store where we started from, I wrote the code
Expected behavior is have two independent variables entityStartPos and tBodyParts, I can then update tBodyParts to a new location and use entityStartPos to reference where it started from,
However what lua has done here is create a reference between the 2 variables, so if i update tBodyParts will also update entityStartPos to the same value,
So the code
will print out the same number twice even though two different variables are being used
One way to fix this is to call the GetPosition update twice as below, as this causes the table to be copied so a reference can’t be crated
I more made this thread as one a be careful this can happen but also as a question of is this something we expect to happen within Crayta vector?