make_widget: keep original "tostring" value in parenthesis
This provides the usual table ID, which can be useful during debugging.
This commit is contained in:
parent
836aded988
commit
fa6b7c390f
|
@ -110,8 +110,9 @@ function base.make_widget(proxy, widget_name)
|
||||||
-- Add __tostring method to metatable.
|
-- Add __tostring method to metatable.
|
||||||
ret.widget_name = widget_name or object.modulename(3)
|
ret.widget_name = widget_name or object.modulename(3)
|
||||||
local mt = {}
|
local mt = {}
|
||||||
|
local orig_string = tostring(ret)
|
||||||
mt.__tostring = function(o)
|
mt.__tostring = function(o)
|
||||||
return ret.widget_name
|
return string.format("%s (%s)", ret.widget_name, orig_string)
|
||||||
end
|
end
|
||||||
return setmetatable(ret, mt)
|
return setmetatable(ret, mt)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue