IMHO, 3%3 =0 so (3%3)+1 = 1
i've just tested the following code to be sure and it prints what it's
meant to print.
--
t = { 1, 2, 3, 4, 5 }
function changeWidgets ()
   i =  ( i %  #t ) + 1
   return i
end

i = 0
for j = 1, 2*#t do
   print( changeWidgets() )
end
--
So i'm not sure the incrment line is the problem line.
I've also noticed that changing the widgets do work at the beginning but if
i insert the systray in the wibox, this one is permanently displayed.


2013/1/12 Bryan Gardiner <[email protected]>

> On Sat, 12 Jan 2013 21:06:00 +0100
> david cobac <[email protected]> wrote:
>
> > Hi, i'm new with awesome
> > i'd like to change wibox widgets with this kind of code :
> >
> > --
> > ilw = 1
> > myWiboxWidgets = {
> >    {cputw,},
> >    {batw, },
> >    {gputw,}
> > }
> > function changeWidgets ()
> >    ilw =  ( ilw %  #myWiboxWidgets ) + 1
> >    mywibox.widgets = myWiboxWidgets[ilw]
> > end
> > --
> >
> > but the third time i change, the wibox is and stay empty.
> > What am i doing wrong ?
> >
> > awesome v3.4.11
>
> Your 'increment' line is not quite right.  If you've changed twice so
> that ilw = 3, and you change again, then
>
>         ilw = (3 % 3) + 1 = 4
>
> rather than 1.
>
> Cheers,
> Bryan
>
> --
> If Steins Gate so decrees, then so am I compelled to behave!
>
> --
> To unsubscribe, send mail to [email protected].
>



-- 
Cordialement
                           David Cobac

Reply via email to