[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Shorten long boolean IF conditions?
- From: Daniel Hertrich <dhertrich@...>
- Date: Fri, 19 Aug 2011 09:09:28 +0200
this is my first post to this list. So let me introduce myself shortly:
My name is Daniel, I am 33 years old, live in Germany and came to Lua
about a year ago,
because I use the NoteCase Pro outliner a lot, which uses Lua as its
scripting language (http://www.notecasepro.com).
Since then I have learned Lua mainly using the available online
ressources and trial & error.
I have written a complete Getting Things Done task management system
for NoteCase Pro in Lua, which currently has about 2000 lines of Lua
code, as well as a lot of other Lua scripts which help with
information management in NoteCase Pro (so my experience with Lua sums
up to about 5000 lines of Lua code, although I know of course that the bare
number of lines of code is not an appropriate measure for quality of programming
Now I come to my first question to you:
I'd like to shorten an if condition such as:
if strCustomPropertyValue == "inbox" or strCustomPropertyValue ==
"today" or strCustomPropertyValue == "thisweek" or
strCustomPropertyValue == "thismonth" or strCustomPropertyValue ==
"thisyear" or strCustomPropertyValue == "later" or
strCustomPropertyValue == "someday" or strCustomPropertyValue ==
"archive" or strCustomPropertyValue == "otherpersons" then
to something like (pseudocode):
if strCustomPropertyValue in ("inbox", "today", "thisweek",
"thismonth", "thisyear", "later", "someday", "archive",
Is something like this possible in Lua? I have not found a way yet.
Thanks a lot,