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:
Daniel Hahler 2015-07-29 21:09:08 +02:00
parent 836aded988
commit fa6b7c390f
1 changed files with 2 additions and 1 deletions

View File

@ -110,8 +110,9 @@ function base.make_widget(proxy, widget_name)
-- Add __tostring method to metatable.
ret.widget_name = widget_name or object.modulename(3)
local mt = {}
local orig_string = tostring(ret)
mt.__tostring = function(o)
return ret.widget_name
return string.format("%s (%s)", ret.widget_name, orig_string)
end
return setmetatable(ret, mt)
end