moonsharp icon indicating copy to clipboard operation
moonsharp copied to clipboard

Fix for #236 (__newindex implementation)

Open Joy-less opened this issue 2 years ago • 0 comments

local MT = {}
function MT:__newindex(key, value)
  print('['..key..'] = '..value)
end
local T = {}
setmetatable(T, MT)
T.A, T.B, T.C = 1, 2, 3

Previously, this would output

[A] = 1
[B] = 2
[C] = nil

With the fix, it outputs

[A] = 1
[B] = 2
[C] = 3

(This is a somewhat surface-level fix, the cause of the issue is probably very deep-rooted)

Joy-less avatar Aug 13 '23 22:08 Joy-less