diff --git a/lib/debugger/debugger.lua b/lib/debugger/debugger.lua index 180cbcf1..56996a56 100644 --- a/lib/debugger/debugger.lua +++ b/lib/debugger/debugger.lua @@ -115,6 +115,20 @@ Debugger.__index = Debugger ``` ]=] +--[=[ + @prop loopParameterNames {string} + @within Debugger + + Create this property in Debugger to specify the names of the parameters to your Loop constructor. This is used to + display a more accurate name in the debugger. + + If not specified, the default behavior is to label Worlds as "World" and tables as "table", followed by its index. + + ```lua + debugger.loopParameterNames = {"World", "State", "Widgets"} + ``` +]=] + --[=[ Creates a new Debugger. @@ -149,6 +163,7 @@ function Debugger.new(plasma) local self = setmetatable({ plasma = plasma, loop = nil, + loopParameterNames = {}, enabled = false, componentRefreshFrequency = 3, _windowCount = 0, diff --git a/lib/debugger/ui.lua b/lib/debugger/ui.lua index 7f7e171a..e1127a7a 100644 --- a/lib/debugger/ui.lua +++ b/lib/debugger/ui.lua @@ -82,8 +82,11 @@ local function ui(debugger, loop) local selected = (#objectStack > 0 and object == objectStack[#objectStack].value) or (debugger.debugWorld == object and worldViewOpen) + local name = debugger.loopParameterNames[index] + local defaultName = (if isWorld then "World" else "table") .. " " .. index + table.insert(items, { - text = (if isWorld then "World" else "table") .. " " .. index, + text = if name then name else defaultName, icon = if isWorld then "🌐" else "{}", object = object, selected = selected,