summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_crawl.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2012-10-04 14:53:23 -0400
committerNeil Moore <neil@s-z.org>2012-10-04 14:53:23 -0400
commit522fc6560878ea40e6f5e4f02a51c4b89c317ade (patch)
treee5483b9ab612f19df22642259be5a07d0d0ed037 /crawl-ref/source/l_crawl.cc
parent2ea6c124b5a66ee20e28bbef4150770923ca42f9 (diff)
downloadcrawl-ref-522fc6560878ea40e6f5e4f02a51c4b89c317ade.tar.gz
crawl-ref-522fc6560878ea40e6f5e4f02a51c4b89c317ade.zip
Allow prepending with listopt ^= foo.
No documentation yet, and needs serious testing. For a few options*, this is slow: O((n+k)*k) where n is the length of the original list and k the number of new items. This could be fixed with some code code restructuring. [*] enemy_hp_colour, fire_order, message_colour, and the Lua-defined options runrest_ignore_message, runrest_stop_message, and runrest_ignore_monster.
Diffstat (limited to 'crawl-ref/source/l_crawl.cc')
-rw-r--r--crawl-ref/source/l_crawl.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc
index 4d6f5ce665..609cca207f 100644
--- a/crawl-ref/source/l_crawl.cc
+++ b/crawl-ref/source/l_crawl.cc
@@ -615,7 +615,8 @@ static int crawl_split(lua_State *ls)
return 0;
vector<string> segs = split_string(token, s);
- lua_newtable(ls);
+ if (lua_isboolean(ls, 3) && lua_toboolean(ls, 3))
+ reverse(segs.begin(), segs.end());
for (int i = 0, count = segs.size(); i < count; ++i)
{
lua_pushstring(ls, segs[i].c_str());