lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> [14-03-11 19:36]:
> > But how can I handle different length of prefixes with directly
> > following data... ?
> 
> Just change the logic to extract the prefixes. Perhaps something like this:
> 
> 	local h =  handlers[line:sub(1,1)]
> 		or handlers[line:sub(1,2)]
> 		or handlers[line:sub(1,3)]
> 		or badprefix
> 

Suppose I have one character code like this

A;0000;0000;0000             ("0"s is data)

and another one

AB;0000;0000;0000             ("0"s is data)

and another one

ABC;0000;0000;0000             ("0"s is data)

then this wouldn't work, would it?

I am ONLY asking to check whether I have understood
this code...nothing more! There is no hidden critism
between the lines I wrote! :))