summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/luadgn.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-25 19:54:59 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-25 19:54:59 +0000
commit7ce53143a6ea781bb9bd2eb29995c6d160331328 (patch)
tree3a9aa283080572b5cc8fbb0eb9f30a8cdb55e465 /crawl-ref/source/luadgn.h
parent648c698c072f989a8e351efbac07a0c9afb9b638 (diff)
downloadcrawl-ref-7ce53143a6ea781bb9bd2eb29995c6d160331328.tar.gz
crawl-ref-7ce53143a6ea781bb9bd2eb29995c6d160331328.zip
.des files can use a global Lua prelude (before maps are defined) that runs
at start of game, before any maps are loaded, and does not run in the context of any specific map. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1654 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/luadgn.h')
-rw-r--r--crawl-ref/source/luadgn.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/crawl-ref/source/luadgn.h b/crawl-ref/source/luadgn.h
index f8b272f544..6c619af05e 100644
--- a/crawl-ref/source/luadgn.h
+++ b/crawl-ref/source/luadgn.h
@@ -13,6 +13,9 @@
extern CLua dlua;
+// Lua chunks cannot exceed 512K. Which is plenty!
+const int LUA_CHUNK_MAX_SIZE = 512 * 1024;
+
class dlua_chunk
{
private:
@@ -27,7 +30,7 @@ private:
std::string get_chunk_prefix(const std::string &s) const;
public:
- std::string error;
+ mutable std::string error;
public:
dlua_chunk(const std::string &_context = "dlua_chunk");
@@ -35,8 +38,8 @@ public:
void add(int line, const std::string &line);
void set_chunk(const std::string &s);
- int load(CLua *interp);
- int load_call(CLua *interp, const char *function);
+ int load(CLua &interp);
+ int load_call(CLua &interp, const char *function);
void set_file(const std::string &s);
const std::string &lua_string() const { return chunk; }
@@ -44,6 +47,9 @@ public:
bool rewrite_chunk_errors(std::string &err) const;
bool empty() const;
+
+ void write(FILE *) const;
+ void read(FILE *);
};
void init_dungeon_lua();