lua-users home
lua-l archive

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


On 2 May 2012 18:32, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Sat, Apr 28, 2012 at 10:45 PM, David Manura <dm.lua@math2.org> wrote:
>> to use Microlight rather than roll their own functions.  As a case in
>> point: ml.escape is currently incompatible with 5.1 due to \0
>> handling.  Test case to add:
>
> Not sure how to fix this, because the Lua 5.1 handling of \0 is not consistent:
>
>> =('a\000'):find'\000'
> 2       2
>> =#('a\000'):match'\000'
> 0
>
> i.e. works fine for _finding_, but you get an 'empty' string when matching.

You have to use %z to match embedded nulls; a unexpected lesson I
learnt long ago.
On the other hand; everything works fine with classes (ie; %S will match \0).

D