Lua library for Internet mail?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua library for Internet mail?

Norman Ramsey-2
Has anybody got a Lua library for parsing Internet mail messages?
I'm especially interested in parsing RFC 821 addresses.


Norman

Reply | Threaded
Open this post in threaded view
|

Re: Lua library for Internet mail?

Diego Nehab-3
Hi,

> Has anybody got a Lua library for parsing Internet mail messages?
> I'm especially interested in parsing RFC 821 addresses.

I  have written  a module  to parse  a mailbox  into its  messages, each
message into  its headers and body  parts and each header  into its name
and value. It is used in the LuaSocket test procedures.

LuaSocket has also module that parses URLs.  Maybe it can be adapted for
your needs, without much  effort. If we reach a nice  API, maybe I could
officially support it. Can specify the kind of problem you are trying to
solve?

Regards,
Diego.


Reply | Threaded
Open this post in threaded view
|

Table assignments in varargs function call

Peter Loveday-2
Greetings!

I am looking for a way to pass table assignments directly in
a function call.  Given that a varargs function simply produces
a table 'arg', I was hoping this might have been possible.
I am trying to achieve syntax like:

function xyzzy(...)
...
end

a = xyzzy(A = 1, B = 2)


Is there any way to achieve this?  I currently have:

function xyzzy(tbl)
...
end


a = xyzzy({ A = 1, B = 2})

But as these calls are for end-user (ie non-programmer) usage,
I really want to reduce the confusion and clutter of the extra
braces if possible.

Thanks!

Love, Light and Peace,
- Peter Loveday
eyeon Software



Reply | Threaded
Open this post in threaded view
|

Re: Table assignments in varargs function call

Gavin Wraith-2
On Tue 20 Nov, Peter Loveday wrote:
 
> a = xyzzy({ A = 1, B = 2})
> 
> But as these calls are for end-user (ie non-programmer) usage,
> I really want to reduce the confusion and clutter of the extra
> braces if possible.

Just leave out the parentheses:

  a = xyzzy { A = 1, B = 2}

Is that not good enough?
-- 
Gavin Wraith ([hidden email])
Home page: http://www.wraith.u-net.com/


Reply | Threaded
Open this post in threaded view
|

Re: Table assignments in varargs function call

Eric Tetz-2
In reply to this post by Peter Loveday-2
--- Peter Loveday <[hidden email]> wrote:
> I am trying to achieve syntax like:
> 
> function xyzzy(...)
> ...
> end
> 
> a = xyzzy(A = 1, B = 2)
> 
> Is there any way to achieve this?  I currently have:
> 
> function xyzzy(tbl)
> ...
> end
> 
> a = xyzzy({ A = 1, B = 2})

You can just say:

a = xyzzy{ A = 1, B = 2 }

Cheers,
Eric


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

Reply | Threaded
Open this post in threaded view
|

Re: Table assignments in varargs function call

James Hearn
In reply to this post by Peter Loveday-2
If the only argument to a function is a single table you can eliminate the
parentheses, only using the braces...

--James Hearn


Reply | Threaded
Open this post in threaded view
|

Re: Lua library for Internet mail?

Norman Ramsey-2
In reply to this post by Diego Nehab-3
 > > Has anybody got a Lua library for parsing Internet mail messages?
 > > I'm especially interested in parsing RFC 821 addresses.
 >
 > Can specify the kind of problem you are trying to solve?

I want a library to build, send, and parse email messages.
For example, I would like to parse my entire existing email archives
and build a Lua table mapping full name to most recent email address.


Norman