=> On [2012-06-16 09:32:15 +0200]:
 Zsolt Udvari Said: 
> First:
> - try write your algorithm in a plain lua (without awesome): you can
> open a file with io.open and can read with f:read() - see:
> http://www.wellho.net/resources/ex.php4?item=u110/boring
> - if you want run it hourly, you'll need timer:
> http://awesome.naquadah.org/doc/api/modules/timer.html and an example:
> http://awesome.naquadah.org/wiki/Widgets_in_awesome#textbox
Help me a lot, I have write some code, but I run it, it can not display what I
want. I hope someone can correct this.
here is my code:
```lua
    mytextword = widget({ type = "textbox" })
    mytextword.text = "" .. ccyan .. "text » " .. coldef .. cred .. " text " .. 
coldef .. ""

    -- change displaied statements per 30 minutes.
    mytimer = timer({ timeout = 30 })
    mytimer:add_signal("timeout", function()
        statements_file = io.open(configdir .. "/statements.txt", "r")
        while True do
            line = statements_file.read(statements_file)
            if not line then break end
            mytextword.text = line
        end
    end)
    mytimer:start()

```

> I hope this helps.

> Zsolt


> 2012/6/16 stardiviner <[email protected]>:
> > I do not know Lua, (actually I read a little Lua syntax already. But I do 
> > not
> > know how to write this in rc.lua)
> > I hope someone can implement this for me.

> > I want to display a statement on the widget.
> > This statement will change per 1 hour.
> > Those statement can be read from a file, or stored in a array variable in 
> > rc.lua
> > file.
> > That's all.


> > --
> > [ stardiviner ] ^^&^^ {I hate all of you !  Leave me alone}
> > IRC(freenode): stardiviner     \\ Twitter:  @numbchild \\
> > GnuPG Key fingerprint
> >    >>> 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433

> --
> To unsubscribe, send mail to [email protected].

-- 
[ stardiviner ] ^^&^^ {I hate all of you !  Leave me alone}
IRC(freenode): stardiviner     \\ Twitter:  @numbchild \\
GnuPG Key fingerprint
    >>> 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433

Attachment: signature.asc
Description: Digital signature

Reply via email to