summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_crawl.cc
diff options
context:
space:
mode:
authorelliptic <hyperelliptical@gmail.com>2011-11-25 02:34:33 -0500
committerelliptic <hyperelliptical@gmail.com>2011-11-25 02:38:11 -0500
commitba6737dae85b10480942b121de57cfe56cfebb22 (patch)
tree0fbd8ea8ace4431b8dc423ed8b4a1f8d51d3f166 /crawl-ref/source/l_crawl.cc
parent48d548079f3220a7b8e081400b864cfe33e78d81 (diff)
downloadcrawl-ref-ba6737dae85b10480942b121de57cfe56cfebb22.tar.gz
crawl-ref-ba6737dae85b10480942b121de57cfe56cfebb22.zip
Add two clua functions.
crawl.messages(n) returns the last n messages in your history. you.see_invisible() tells you whether you know that you can see invisible.
Diffstat (limited to 'crawl-ref/source/l_crawl.cc')
-rw-r--r--crawl-ref/source/l_crawl.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc
index 05e00d6d7b..a055600f44 100644
--- a/crawl-ref/source/l_crawl.cc
+++ b/crawl-ref/source/l_crawl.cc
@@ -487,6 +487,13 @@ static int crawl_take_note(lua_State *ls)
return (0);
}
+static int crawl_messages(lua_State *ls)
+{
+ const int count = luaL_checkint(ls, 1);
+ lua_pushstring(ls, get_last_messages(count).c_str());
+ return (1);
+}
+
#define REGEX_METATABLE "crawl.regex"
#define MESSF_METATABLE "crawl.messf"
@@ -857,6 +864,7 @@ static const struct luaL_reg crawl_clib[] =
{ "msgch_num", crawl_msgch_num },
{ "msgch_name", crawl_msgch_name },
{ "take_note", crawl_take_note },
+ { "messages", crawl_messages },
{ "regex", crawl_regex },
{ "message_filter", crawl_message_filter },