moonsharp-devs / moonsharp

An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.
http://www.moonsharp.org
Other
1.41k stars 213 forks source link

Incorrect __newindex implementation #236

Open Ayplow opened 5 years ago

Ayplow commented 5 years ago

Attempting to use multiple assignment on a table with a __newindex metamethod, only the first value will be forwarded to it.

To Reproduce

In moonsharp, the following script

local MT = {}
function MT:__newindex(key, value)
  print(key, " was assigned to [", value, "]")
end
local T = {}
setmetatable(T, MT)
T.A, T.B = 1, 2

produces this output

A was assigned to [1]
B was assigned to [nil]

Expected behavior The official Lua interpreter outputs

B        was assigned to [      2       ]
A        was assigned to [      1       ]
Joy-less commented 1 year ago

Fix in #325