lua-users home
lua-l archive

Most efficient way to recognize a line by its first (up to) three characters

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


Hi,
(using Lua 5.2.2 under Linux)
from a serial line I receive A LOT of lines
consisting of data in ASCII format.
The first one to three characters decide, how
I have to interpret the data.
Since data are transmitted FAST I want to make
the recognition code which branches into the
different data processing parts as efficient
as possible. The code will run on a embedded
system, so I will not have the memory for huge
look-up table or such...
And I will do it in pure Lua since this is the
reason why I do this in pure Lua! ;)
What is the "best" solution?
('best' in "" since this also a product of the
point of view ;)
Thank you very much for any help in advance!
Best regards,
mcc

AltStyle によって変換されたページ (->オリジナル) /