From 7ce53143a6ea781bb9bd2eb29995c6d160331328 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Mon, 25 Jun 2007 19:54:59 +0000 Subject: .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 --- crawl-ref/source/luadgn.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/luadgn.h') 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(); -- cgit v1.2.3-54-g00ecf