lua-users home
lua-l archive

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


On Tue, Jan 5, 2016 at 8:55 AM, Soni L. <fakedme@gmail.com> wrote:
> On 05/01/16 07:51 AM, Jonathan Goble wrote:
>> And this proposal would make that even more powerful:
>>
>>> str = [[char str[] = "this \"is\" a test"]]
>>> str
>>
>> char str[] = "this \"is\" a test"
>>>
>>> str:match[[%B"\"]]
>>
>> "this \"is\" a test"
>>
>> Poof: instant matching of string literals with escape handling, in a
>> five-character pattern. How cool is that? :-)
>>
> Meh, there's a lib for it
> https://github.com/SoniEx2/Stuff/blob/master/lua/String.lua

I hardly think that 273 lines of Lua can be compared to essentially 10
lines of C. It's pretty obvious which would be faster.

Also, your solution is for a single, very specialized use case, while
mine is a more general solution covering many different use cases.

Both can coexist here; the presence of your module (a great one from
the looks of it, I should add) should not in any way hold this up.