lua-users home
lua-l archive

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

Hi All

I have a tables where the size is between 1000 and 10000.  The user needs to select various table elements.  An effective manner to select table elements is through a query language.

The query language is lua, where the query string is executed with a do string.

What I would like to do is to have a query language much like SQL where the _expression_ is something like

(timeZone == "EST") or ( device =="CLX" )

where timeZone and device are fields in the lua table.

I was able to make the query language work by using the following string

{ ts.entry.timeZone == "EST") or ( ts.entry.timeZone == "PST")

ts.entry is variable from a pairs iteration over the table.

Two questions
1.  Is there a better way to do a query language over a set of tables
2.  If not is there a easy way in lua to transform the query string
(timeZone == "EST") or ( timeZone == "PST")

{ ts.entry.timeZone == "EST") or ( ts.entry.timeZone == "PST")