Skip to content

Commit

Permalink
reuse meta table check boolean in a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
lL1l1 committed Dec 22, 2024
1 parent e0e679b commit 584e5ba
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lua/system/repr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,17 @@ function Inspector:putValue(v)
end

local mt = getmetatable(t)
if self.meta then
if type(mt) == 'table' and not TableEmpty(mt) then
if seqLen + keysLen > 0 then puts(buf, ',') end
tabify(self)
puts(buf, '<metatable> = ')
self:putValue(mt)
end
local checkMetaTable = self.meta and type(mt) == 'table' and not TableEmpty(mt)
if checkMetaTable then
if seqLen + keysLen > 0 then puts(buf, ',') end
tabify(self)
puts(buf, '<metatable> = ')
self:putValue(mt)
end

self.level = self.level - 1

if keysLen > 0 or (self.meta and type(mt) == 'table' and not TableEmpty(mt)) then
if keysLen > 0 or checkMetaTable then
tabify(self)
elseif seqLen > 0 then
puts(buf, ' ')
Expand Down

0 comments on commit 584e5ba

Please sign in to comment.