summaryrefslogtreecommitdiff
path: root/lib/LuaHandle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LuaHandle.cc')
-rw-r--r--lib/LuaHandle.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc
index 207c4e7..789876e 100644
--- a/lib/LuaHandle.cc
+++ b/lib/LuaHandle.cc
@@ -829,15 +829,21 @@ int sLuaHandle::zlib_deflate(lua_State * __L) {
int n = L->gettop();
Handle * s, * d;
int r;
+ int level = Z_DEFAULT_COMPRESSION;
+ bool raw = false;
- if (n != 2) {
+ if ((n < 2) || (n > 4) || ((n >= 3) && !L->isnumber()) || ((n == 4) && !L->isboolean())) {
L->error("Incorrect arguments to method `Handle::zlib_deflate'");
}
s = L->recast<Handle>(1);
d = L->recast<Handle>(2);
+ if (n >= 3)
+ level = L->tonumber(3);
+ if (n == 4)
+ raw = L->toboolean(4);
- r = Handle::zlib_deflate(s, d);
+ r = Handle::zlib_deflate(s, d, level, raw);
L->push((lua_Number) r);