3 ms·
An alternative to the suggestion to use a regex C library is to embed Lua code into your C code. Lua+C is great for resource constrained embedded systems and ca
by protomok 10y ago
An alternative to the suggestion to use a regex C library is to embed Lua code into your C code. Lua+C is great for resource constrained embedded systems and can make text parsing a lot less painful than using pure C.
The Lua docs provide some examples of integrating Lua into C here - https://www.lua.org/pil/24.1.html https://www.lua.org/pil/24.1.html.
- StavrosK 10y agoThe problem there is that usually you're constrained to 2 kb of RAM or so for an Arduino, so that's too heavyweight :/ Plus, it's outside my abilities currently, sadly.
- krylon 10y ago> Plus, it's outside my abilities currently, sadly. If your target only has two KB of RAM, Lua is a no-go, I guess. But skill-wise, I can highly recommend it. The reference manual is very well-written, the Lua language itself is very nice and easy to learn, and Lua's C interface is very pleasant to use; and again: the documentation is very good. (Also, the community is very friendly!) If you ever take a shot at it, the Lua Users Wiki (http://lua-users.org/wiki/ http://lua-users.org/wiki/) is a good starting point.
- StavrosK 10y agoHmm, the example you posted doesn't actually look very complicated at all! And I agree, Lua is a very nice language, I've used it for other projects.
- ArkyBeagle 10y agoPerhaps because I've done it all my adult life, I've never understood how text manipulation in 'C' is all that painful.