summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/clua.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-27 07:49:52 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-27 07:49:52 +0000
commit9ba7349f93aeca1bb45a083235f3576f5096a995 (patch)
tree278d98ebd1d6811ef8d2e5496e3630cb87054c2c /crawl-ref/source/clua.cc
parentea6a050bf6b67faf4f9cce0cd8ee802f75ba21e3 (diff)
downloadcrawl-ref-9ba7349f93aeca1bb45a083235f3576f5096a995.tar.gz
crawl-ref-9ba7349f93aeca1bb45a083235f3576f5096a995.zip
The dungeon builder now caches compiled Lua chunks instead of Lua source in the
.dsc to save on compile time (at the expense of larger .dsc files). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1663 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/clua.cc')
-rw-r--r--crawl-ref/source/clua.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 8ea71c26e4..6a4e54074e 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -31,6 +31,7 @@
#include "skills2.h"
#include "spl-util.h"
#include "stuff.h"
+#include "travel.h"
#include <cstring>
#include <map>
@@ -202,13 +203,18 @@ void CLua::init_throttle()
}
}
-int CLua::loadstring(const char *s, const char *context)
+int CLua::loadbuffer(const char *buf, size_t size, const char *context)
{
- const int err = luaL_loadbuffer(state(), s, strlen(s), context);
+ const int err = luaL_loadbuffer(state(), buf, size, context);
set_error(err, state());
return err;
}
+int CLua::loadstring(const char *s, const char *context)
+{
+ return loadbuffer(s, strlen(s), context);
+}
+
int CLua::execstring(const char *s, const char *context)
{
int err = 0;
@@ -711,6 +717,7 @@ LUARET1(you_levitating, boolean,
LUARET1(you_flying, boolean,
player_is_levitating() && wearing_amulet(AMU_CONTROLLED_FLIGHT))
LUARET1(you_transform, string, transform_name())
+LUARET1(you_where, string, level_id::current().describe().c_str())
LUAWRAP(you_stop_activity, interrupt_activity(AI_FORCE_INTERRUPT))
void lua_push_floor_items(lua_State *ls);
@@ -783,6 +790,8 @@ static const struct luaL_reg you_lib[] =
{ "stop_activity", you_stop_activity },
{ "floor_items", you_floor_items },
+
+ { "where", you_where },
{ NULL, NULL },
};