-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Incorrect result for multi-assignment #315
Comments
It looks like the Problem is within Changing this so the variable is always looked up works and the tests still pass. However I don't know if there is some edge case which requires the variable not to be looked up. |
I can create a pull request yes. I was just hoping yuin would maybe give us some insight on this |
Alright after looking into this a little more - I think there is something broken in the way multi assignment works in gopher-lua. do
local a,i,j,b
a = {'a', 'b'}; i=1; j=2; b=a
i, a[i], a, j, a[j], a[i+j] = j, i, i, b, j, i
assert(i == 2 and b[1] == 1 and a == 1 and j == b and b[2] == 2 and
b[3] == 1)
end I really don't know enough about how lua or gopher-lua works to fix this. I think this is something @yuin should get involved in. |
@yuin any thoughts? |
Hooray! |
The mentioned test still fails with this change.
|
This issue has been closed because the original issue was resolved. |
Please answer the following before submitting your issue:
GopherLua 0.1 Copyright (C) 2015 -2017 Yusuke Inuzuka
glua ./repro.lua
where the file contains:1, e
d, e
Somehow the property-access in the multi-assignment causes
f
to contain the name of the second variable on the right side instead of the value of the 1st variable on the right side.As a note, swapping the sequence results in the correct behavior:
a.d, f = d, f
Reference: #314
The text was updated successfully, but these errors were encountered: