lua-users home
lua-l archive

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


I wrote a small function in Lua to do that. Has worked fine till now for me, you can copy it from here and try it out:

https://github.com/aryajur/many2one/blob/15e8de2b031e2cbe659a420ae29952df21fa3f47/src/many2one.lua#L148



On Mon, 24 Jul 2023 at 00:58, Kartik Agaram <ak@akkartik.com> wrote:
Hi everyone,

I've been thinking about the problem of stripping comments (including long/block comments) from a string containing Lua code. Is there some way to do this that is shorter than an imperative byte-by-byte state machine? I've considered Lua's patterns and also the Lpeg library, but without success.

Thanks,
Kartik