lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Aug 4, 2013 at 5:55 PM, Michal Kottman <michal.kottman@gmail.com> wrote:

Can someone explain what the above error means and what is causing it? Another question, where do the capability() and select() functions come from (I don't see them in the imap code)?

The library is a very thin binding over the IMAP protocol, and all magic happens in IMAP_META:command() and IMAP_META.__index. IMAP_META:command(cmd, ...)  will format the IMAP command with the arguments, like adding a sequence number, converting the command to uppercase and concatenating all arguments with spaces. It will then send the command and collect all results into a table, which it returns.

IMAP_META.__index then provides a simple interface over IMAP_META:command(cmd) - instead of writing imap:command("select", ...), you can just do imap:select(...).

Thanks for the updated version. Another question:

How can I include a variable within gmail:search. I tried the following variations (but get an error "function arguments expected near 'SearchFilter'"

local yesterday = os.date("%d-%b-%Y",os.time()-24*60*60)
SearchFilter = "SUBJECT Test SINCE " .. yesterday
-- local headers = gmail:search "\"" .. SearchFilter .. "\""
-- local headers = gmail:search "SUBJECT Test Since " .. yesterday
local headers = gmail:search SearchFilter

Thanks,
       
--
 - Chris