summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-11-08 20:26:30 -0800
committerPixel <pixel@nobis-crew.org>2009-11-08 20:26:30 -0800
commit15b0e9849e3830eefc6c98aa7d0858981a0318b5 (patch)
tree590a3f6de94a0c80964d2fe57ceceeca81be98f3 /lib
parent52e5bd7a3b0b2062638a221e2b9a179ae20338f1 (diff)
Adding the ability to open archives from Lua.
Diffstat (limited to 'lib')
-rw-r--r--lib/LuaHandle.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc
index ce6d48c..376e485 100644
--- a/lib/LuaHandle.cc
+++ b/lib/LuaHandle.cc
@@ -77,6 +77,7 @@ class sLuaHandle : public Base {
static int ucl_decompress(lua_State * L);
static int ucl_overlap(lua_State * L);
#endif
+ static int archive(lua_State * L);
private:
static int read(lua_State * L, int);
static int write(lua_State * L, int);
@@ -658,6 +659,19 @@ int sLuaHandle::ucl_overlap(lua_State * __L) {
}
#endif
+int sLuaHandle::archive(lua_State * __L) {
+ Lua * L = Lua::find(__L);
+ int n = L->gettop();
+
+ if ((n != 1) || !L->isstring(1)) {
+ L->error("Archive needs exactly one string argument.");
+ }
+
+ new Archive(L->tostring(1));
+
+ return 0;
+}
+
int sLuaHandle::seek(lua_State * __L) {
Lua * L = Lua::find(__L);
int n = L->gettop();
@@ -901,4 +915,6 @@ void LuaHandle::pushconstruct(Lua * L) {
L->declarefunc("ucl_decompress", sLuaHandle::ucl_decompress);
L->declarefunc("ucl_overlap", sLuaHandle::ucl_overlap);
#endif
+
+ L->declarefunc("Archive", sLuaHandle::archive);
}