summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/clua.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-09-04 02:44:17 +0200
committerAdam Borowski <kilobyte@angband.pl>2010-09-04 02:44:17 +0200
commita2f257aecb00e73e7aec602d8fd7795d5993019c (patch)
tree1f22c48ce222a96cea1c26ada550698acaa8e568 /crawl-ref/source/clua.cc
parent1f40d3bf8b813bd7bd66f4bf9e28a4166a3bc0b2 (diff)
downloadcrawl-ref-a2f257aecb00e73e7aec602d8fd7795d5993019c.tar.gz
crawl-ref-a2f257aecb00e73e7aec602d8fd7795d5993019c.zip
Store the "lua" subfile as a chunk.
Diffstat (limited to 'crawl-ref/source/clua.cc')
-rw-r--r--crawl-ref/source/clua.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 686017f555..2570ba9b30 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -116,15 +116,14 @@ void CLua::gc()
lua_gc(state(), LUA_GCCOLLECT, 0);
}
-void CLua::save(const char *file)
+void CLua::save(writer &outf)
{
if (!_state)
return;
- CLuaSave clsave = { file, NULL };
- callfn("c_save", "u", &clsave);
- if (clsave.handle)
- fclose(clsave.handle);
+ std::string res;
+ callfn("c_save", ">s", &res);
+ outf.write(res.c_str(), res.size());
}
int CLua::file_write(lua_State *ls)