summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/LuaHandle.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc
index ec1f573..329c7e7 100644
--- a/lib/LuaHandle.cc
+++ b/lib/LuaHandle.cc
@@ -590,14 +590,17 @@ int sLuaHandle::ucl_compress(lua_State * __L) {
Lua * L = Lua::find(__L);
int n = L->gettop();
Handle * s, * d;
- int r;
+ int r, l = -1;
- if (n != 2) {
+ if (!((n >= 2) && (n <= 3))) {
L->error("Incorrect arguments to method `Handle::ucl_compress'");
}
s = L->recast<Handle>(1);
d = L->recast<Handle>(2);
+ if (n == 3) {
+ l = L->tonumber(3);
+ }
r = Handle::ucl_compress(s, d);
@@ -610,17 +613,20 @@ int sLuaHandle::ucl_decompress(lua_State * __L) {
Lua * L = Lua::find(__L);
int n = L->gettop();
Handle * s, * d;
- int r, l;
+ int r, l, l_in = -1;
- if ((n != 3) || (!L->isnumber(3))) {
+ if (!((n >= 3) && (n <= 4)) || (!L->isnumber(3))) {
L->error("Incorrect arguments to method `Handle::ucl_decompress'");
}
s = L->recast<Handle>(1);
d = L->recast<Handle>(2);
l = L->tonumber(3);
+ if (n == 4) {
+ l_in = L->tonumber(4);
+ }
- r = Handle::ucl_decompress(s, d, l);
+ r = Handle::ucl_decompress(s, d, l, l_in);
L->push((lua_Number) r);