On Thu, Jul 08, 2004 at 11:51:11PM +0200, miGlanz wrote:
> kpress(SECOND_MOD.."F1", function(scr)
>       popen_bgread("/home/kamil/.ion2/mailstat.sh",
>               function (data)
>                       newmail = string.sub(data,string.find(data,"%d*"))
>                       oldmail = string.sub(data,string.find(data,"%d*")+1)
>                       query_message(scr, os.date() .. "\nNumber of new messages: " 
> .. newmail .. "\nNumber of read messages: " .. oldmail)
>               end)
>       end),

Note that the size of 'data' is arbitrary. To do this "correctly", you
should collect new data until a nil 'data' is passed or you reach other
criterion to stop collecting. For example:

coroutine.wrap(function(s)
                   local cs=""
                   while s do
                       cs=cs..s
                       s=coroutine.yield()
                   end

                   -- now work on cs
               end)


Of course, it may be good to put limits on the size of 'cs', as the 
routines in querylib have.    

-- 
Tuomo

Reply via email to