C strings in LuaJIT

  • From: William Adams <william_a_adams@xxxxxxx>
  • To: <luajit@xxxxxxxxxxxxx>
  • Date: Sun, 13 May 2012 15:21:25 +0000

Has anyone already coded up a set of standard C string functions in LuaJIT? I 
have found that while coding up a web server, the standard C functions for 
string manipulation are useful.
In some cases, where pattern matching is particularly intense, it's useful to 
convert to a lua string, and use string.match, but for a lot of cases, where I 
don't want to do any copying of the received buffer, It's best to just use 
standard C string types of functions. LuaJIT with FFI makes this fairly easy 
because pointer access is readily available. This also has me wondering if 
LuaJIT might not be the new "C" for me.  The main benefit being memory 
management.  I can pretty much code as if I were using C, but still have the 
benefits of the dynamic runtime environment, and the easy interop with the rest 
of the Lua world. -- William

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


Other related posts:

  • » C strings in LuaJIT - William Adams