allow a format function as argument

This commit is contained in:
mutlusun 2017-02-27 10:00:59 +01:00
parent b00e7c6cd0
commit edabd477e2
1 changed files with 7 additions and 3 deletions

View File

@ -261,12 +261,16 @@ end
-- }}} -- }}}
-- {{{ Get custom widget format data -- {{{ Get custom widget format data
function vicious.getdata(myw, format, warg) function vicious.call(myw, format, warg)
return helpers.format(format, myw(format, warg)) local mydata = myw(format, warg)
if type(format) == "string" then
return helpers.format(format, mydata)
elseif type(format) == "function" then
return format(myw, mydata)
end
end end
-- }}} -- }}}
return vicious return vicious
-- }}} -- }}}