Skip to content
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

Add fallback to use typename in debugger when no format defined #3035

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lua/entities/gmod_wire_expression2/core/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
end
end
else
ret = ret .. formatPort[longtype]( v, orientvertical )
ret = ret .. formatPort[longtype](v, orientvertical)
end

if (orientvertical) then
Expand All @@ -105,8 +105,7 @@
if (n > 7) then break end
ret = temp( ret, value, k3, v3, orientvertical, false )
end
ret = ret:Left(-3)
return "{" .. ret .. "}"
return "{" .. ret:sub(1, orientvertical and -2 or -3) .. "}"
end)

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -980,7 +979,7 @@
--------------------------------------------------------------------------------

registerCallback( "postinit", function()
local getf, setf

Check warning on line 982 in lua/entities/gmod_wire_expression2/core/table.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: getf

Check warning on line 982 in lua/entities/gmod_wire_expression2/core/table.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: setf
for k,v in pairs( wire_expression_types ) do
local name = k
local id = v[1]
Expand Down
9 changes: 5 additions & 4 deletions lua/wire/server/debuggerlib.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
local formatPort = {}
local formatPort = setmetatable({}, { __index = function(_, k)
return function() return k end
end
})

WireLib.Debugger = { formatPort = formatPort } -- Make it global
function formatPort.NORMAL(value)
return string.format("%.3f",value)
Expand Down Expand Up @@ -43,8 +47,6 @@ function formatPort.MATRIX4(value)
return RetText
end

function formatPort.RANGER(value) return "ranger" end

function formatPort.ARRAY(value, OrientVertical)
local RetText = ""
local ElementCount = 0
Expand Down Expand Up @@ -154,7 +156,6 @@ function formatPort.TABLE(value, OrientVertical)
return "{"..RetText.."}"
end


function WireLib.registerDebuggerFormat(typename, func)
formatPort[typename:upper()] = func
end
Loading