Rename v to wrapped_func in metawrapper.__newindex()

This commit is contained in:
Gnome Ann 2021-12-12 12:20:01 -05:00
parent d76dd35791
commit e06861bb0b

View File

@ -110,8 +110,8 @@ return function(_python, _bridged)
---@generic T : table ---@generic T : table
---@param t T ---@param t T
---@return T ---@return T
function metawrapper.__newindex(t, k, v) function metawrapper.__newindex(t, k, wrapped_func)
if type(v) == "function" then if type(wrapped_func) == "function" then
return rawset(t, k, function(...) return rawset(t, k, function(...)
local _needs_unwrap = false local _needs_unwrap = false
if not wrapped then if not wrapped then
@ -120,7 +120,7 @@ return function(_python, _bridged)
_needs_unwrap = true _needs_unwrap = true
wrapped = true wrapped = true
end end
local r = {v(...)} local r = {wrapped_func(...)}
if _needs_unwrap then if _needs_unwrap then
metatables:restore() metatables:restore()
wrapped = false wrapped = false
@ -128,7 +128,7 @@ return function(_python, _bridged)
return table.unpack(r) return table.unpack(r)
end) end)
else else
return rawset(t, k, v) return rawset(t, k, wrapped_func)
end end
end end