Thanks Michal I would ask if there's any reason for quoting being equal than double-quoting but forget about it; that's surely off-topic. Pat --- On Wed, 7/18/12, Michal Kottman <k0mpjut0r@xxxxxxxxx> wrote: > From: Michal Kottman <k0mpjut0r@xxxxxxxxx> > Subject: Re: ffi string definitions > To: luajit@xxxxxxxxxxxxx > Date: Wednesday, July 18, 2012, 2:23 AM > On 18 July 2012 11:18, Patrick > Masotta <masottaus@xxxxxxxxx> > wrote: > > hi > > > > 1) I'm trying to pass a Regular Expresion from LUA to C > on a string defined with: > > > > ffi.new("char[?]", 0, "^[cC]:\\.*$"); > > (forget about the length 0 on the definition) > > > > but LUA/FFI "interprets" the \\ finally adding a single > \ to the string > > then I'm forced to pass "^[cC]:\\\\.*$" (Escaping LUA, > then Escaping the regex) > > > > is there anyway to force the no-interpretation of > string content in the ffi definition? i.e I can do that in > BASH just using single quotes instead of double quotes. > > In Lua, you use the [[xxx]] form of string literal [1], so > for your > example it will look like this: . To make sure you do not > close the > literal using ]] in your regexp, you can write a number of > equals > signs between brackets, like [==[^[cC]:\\.*$]==] > > [1] http://www.lua.org/manual/5.1/manual.html#2.1 > >