Hey,
You could do:
netwidget_up = widget({ type = 'textbox', name = 'netwidget_up', align
= 'right' })
wicked.register(netwidget_up, wicked.widgets.net,
function ()
if ${ppp0 up_kb} < 10 then
return "000" . ${ppp0 up_kb}
end
if ${ppp0 up_kb} < 100 then
return "00" . ${ppp0 up_kb}
end
if ${ppp0 up_kb} < 1000 then
return "0" . ${ppp0 up_kb}
end
end , nil, nil, 3)
I am not sure the syntax is OK (I am at work I have no way to check),
but you've got the idea :)
Cheers,
ps: You might also want to use math.ceil(${ppp0 up_kb) for instance,
to keep only the interger part of the number.
--
Damien "pyrho" Rajon
--
To unsubscribe, send mail to [email protected].