[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: String matching on keys of a table
- From: Petite Abeille <petite.abeille@...>
- Date: Sun, 27 Oct 2013 16:33:45 +0100
On Oct 27, 2013, at 4:16 PM, meino.cramer@gmx.de wrote:
> I will take a look at the tries. For curiosity reasons I want to
> try to avoid "ready solutions" (like sqlite). But if my keyboard
> gets spilled with blood til afternoon, I think I will be less
> curious... ;)
Fair enough, nothing like trying it yourself.
That said, before you do bleed too much, what's wrong with a linear search? Considering you just have a handful of keys, is it really that slow?
E.g.
for aKey, aValue in pairs( aTable ) do
if aKey:find( something, 1, true ) then
-- do stuff
end
end