diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-24 05:55:19 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-24 05:55:19 +0000 |
commit | 496a1fc6bb248d48e8d4c9b6bf5c6f8b5360c673 (patch) | |
tree | fe1a97a59013ad288442dabf7c3648a06cbf8ce5 /crawl-ref/source/initfile.cc | |
parent | 0ce4685c4fe385d59c7abafc7ad8b1b5289b4f6e (diff) | |
download | crawl-ref-496a1fc6bb248d48e8d4c9b6bf5c6f8b5360c673.tar.gz crawl-ref-496a1fc6bb248d48e8d4c9b6bf5c6f8b5360c673.zip |
Added support for colon-prefixed Lua one-liners in .crawlrc, documented
Lua fragment syntax sketchily.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1923 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r-- | crawl-ref/source/initfile.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 95b2494c36..60ba59ea53 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -1152,6 +1152,23 @@ void game_options::read_options(InitLineInput &il, bool runscript) if ((str.empty() || str[0] == '#') && !inscriptcond && !inscriptblock) continue; + if (!inscriptcond && str[0] == ':') + { + // The init file is now forced into isconditional mode. + isconditional = true; + str = str.substr(1); + if (!str.empty() && runscript) + { + // If we're in the middle of an option block, close it. + if (luacond.length() && l_init) + { + luacond += "]] )\n"; + l_init = false; + } + luacond += str + "\n"; + } + continue; + } if (!inscriptcond && (str.find("L<") == 0 || str.find("<") == 0)) { // The init file is now forced into isconditional mode. @@ -1160,7 +1177,8 @@ void game_options::read_options(InitLineInput &il, bool runscript) str = str.substr( str.find("L<") == 0? 2 : 1 ); // Is this a one-liner? - if (!str.empty() && str[ str.length() - 1 ] == '>') { + if (!str.empty() && str[ str.length() - 1 ] == '>') + { inscriptcond = false; str = str.substr(0, str.length() - 1); } |