summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_file.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-20 22:05:19 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-20 22:27:33 +0200
commitc6df756b86ae4e28bc342dffa6ab41a7c865fa9a (patch)
treebf186cca4cd530cc72229f1998626187e0665afd /crawl-ref/source/l_file.cc
parent52818f7c83ffb5143f798412ee8d4800fc9de7b7 (diff)
downloadcrawl-ref-c6df756b86ae4e28bc342dffa6ab41a7c865fa9a.tar.gz
crawl-ref-c6df756b86ae4e28bc342dffa6ab41a7c865fa9a.zip
Move remaining libraries from clua.cc.
That's l_file.cc, l_food.cc, l_global.cc.
Diffstat (limited to 'crawl-ref/source/l_file.cc')
-rw-r--r--crawl-ref/source/l_file.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/crawl-ref/source/l_file.cc b/crawl-ref/source/l_file.cc
index 78eb10f289..c44e90e44a 100644
--- a/crawl-ref/source/l_file.cc
+++ b/crawl-ref/source/l_file.cc
@@ -1,10 +1,28 @@
#include "AppHdr.h"
+#include "clua.h"
#include "dlua.h"
#include "l_libs.h"
#include "tags.h"
+///////////////////////////////////////////////////////////
+// User-accessible file operations
+
+static const struct luaL_reg file_clib[] =
+{
+ { "write", CLua::file_write },
+ { NULL, NULL },
+};
+
+void cluaopen_file(lua_State *ls)
+{
+ luaL_openlib(ls, "file", file_clib, 0);
+}
+
+///////////////////////////////////////////////////////////
+// Non-user-accessible file operations
+
static int file_marshall(lua_State *ls)
{
if (lua_gettop(ls) != 2)
@@ -126,7 +144,7 @@ static int file_unmarshall_meta(lua_State *ls)
return (0);
}
-const struct luaL_reg file_dlib[] =
+static const struct luaL_reg file_dlib[] =
{
{ "marshall", file_marshall },
{ "marshall_meta", file_marshall_meta },
@@ -137,3 +155,7 @@ const struct luaL_reg file_dlib[] =
{ NULL, NULL }
};
+void dluaopen_file(lua_State *ls)
+{
+ luaL_openlib(ls, "file", file_dlib, 0);
+}