lua-users home
lua-l archive

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


For simple mapping, how about:

field = " Field1 12345 Field2 45678" -- note space at the start of the string

function fieldMap(key)
    return tonumber(string.match(field, "%s" .. key .. "%s(%d*)"))
end

The field string can be loaded from a file.

Vaughan

2008/11/20 M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>
>
> On Mon, 13 Oct 2008, A.S. Bradbury wrote:
>
>> tinycdb[1] is a public domain implementation which uses mmap. I have
>
> If a pure lua cdb reader is required, try cdb.lua from
>
>  http://discontinuity.info/~rowan/cdb.lua
>
> Cheers,
>
> Joonas