lua-users home
lua-l archive

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


On Fri, 19 Aug 2011 09:09:28 +0200, Daniel Hertrich wrote:

if strCustomPropertyValue in ("inbox", "today", "thisweek",
"thismonth", "thisyear", "later", "someday", "archive",
"otherpersons") then
...
end


Is something like this possible in Lua? I have not found a way yet.

for _,x in ipairs{"inbox", "today", "thisweek",  "thismonth",
"thisyear", "later", "someday", "archive", "otherpersons"} do
  if strCustomPropertyValue == x then
    ...
  end
end

Or you could convert it to a Lua-style Set (see
http://www.lua.org/pil/13.1.html) first:

if (Set.new{"inbox", "today", "thisweek",  "thismonth",
"thisyear", "later", "someday", "archive",
"otherpersons"})[strCustomPropertyValue] then
  ...
end

--
Pierre 'catwell' Chapuis