lua-users home
lua-l archive

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


On Oct 27, 2013, at 12:15 PM, meino.cramer@gmx.de wrote:

> is there anything more sophisticated than linear search, which I can
> do to match a key (string) in a table from a user input, which is only
> a part of that key?

With a plain table, linear search it it. But you could always use a more appropriate structure such as, say, a Trie or similar.

http://en.wikipedia.org/wiki/Trie

Alternatively, depending on your circumstances, you might even want to consider a little embedded db, such as sqlite which, among other things, sports a nifty full text search engine.

http://www.sqlite.org/
http://www.sqlite.org/fts3.html