lua-users home
lua-l archive

Re: 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]


> Suppose I have one character code like this
> 
> A;0000;0000;0000 ("0"s is data)
Now that you've given us a sample of the input, the solution is easier:
	... read line
	local prefix,info=line:match("(.-);(.*)$")
	local h=handlers[p[prefix] or badprefix
	h(prefix,info)
and register handlers for "A", "AB", "ABC", etc.

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