RE: [ANN]LAPHLibs - core C style string routines, plus extras

  • From: William Adams <william_a_adams@xxxxxxx>
  • To: <luajit@xxxxxxxxxxxxx>
  • Date: Mon, 14 May 2012 18:41:43 +0000

I think I'm fairly well covered at the bit level.

 

I can do low level bit twiddling, and stay within the confines of standard Lua 
constructs:

 


http://williamaadams.wordpress.com/2012/05/02/serialization-105-the-lazy-programmer-shares-data/

 

There are things like, parsing a UTC date.  Of course, this is infrequent 
enough that it might just be worthwhile to turn the interesting bit into a Lua 
string, and use the standard string parsing routines.

 

But, there are lots of little things, like parsing http headers, which strchr 
and the like can handle, but the pattern matching in lua is much better.  For 
instance, finding/parsing/capturing a digit in a string is as simple as: (%d+) 
in lua.  The C equivalent is a bit more involved.  I could use scanf and the 
like, but I'd rather stick to pure lua.

 

So, that's the kind of thing I'm after.

 

-- William

 

===============================

- Shaping clay is easier than digging it out of the ground.


http://williamaadams.wordpress.com
http://www.thingiverse.com/WilliamAAdams
https://github.com/Wiladams


----------------------------------------
> Date: Mon, 14 May 2012 19:20:06 +0100
> Subject: Re: [ANN]LAPHLibs - core C style string routines, plus extras
> From: btnfdp.lobato@xxxxxxxxx
> To: luajit@xxxxxxxxxxxxx
>
> On 5/14/12, William Adams <william_a_adams@xxxxxxx> wrote:
>
> > I would love to have the lua string.match function available for straight 
> > buffers as well. Most of this
> > network programming stuff could benefit from what's available in Lua string 
> > library, as well as
> > LPEG, only operating on straight buffers, rather than Lua strings.
>
> What about something like Erlang bit syntax?
>
> http://ftp.sunet.se/pub/lang/erlang/euc/00/bit_syntax.html
>
> http://code.google.com/p/lua-bitstring/
>
> Just a thought.
>                                         

Other related posts: