diff options
author | Pixel <pixel@nobis-crew.org> | 2009-06-03 23:32:55 +0000 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-06-03 23:32:55 +0000 |
commit | 0eb604eeafd829e9aa31c7928d0bd18ff836d3bc (patch) | |
tree | d0e8ce27624db2070acb834841a257088824bc9c /lib/LuaHandle.cc | |
parent | 95446ef8a082e3fe70612b98e75a8667e2a4959f (diff) |
Adding ucl_overlap, and improving / fix a bit the other ucl features.
Diffstat (limited to 'lib/LuaHandle.cc')
-rw-r--r-- | lib/LuaHandle.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index 329c7e7..ce6d48c 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -75,6 +75,7 @@ class sLuaHandle : public Base { #ifdef HAVE_UCL static int ucl_compress(lua_State * L); static int ucl_decompress(lua_State * L); + static int ucl_overlap(lua_State * L); #endif private: static int read(lua_State * L, int); @@ -632,6 +633,29 @@ int sLuaHandle::ucl_decompress(lua_State * __L) { return 1; } + +int sLuaHandle::ucl_overlap(lua_State * __L) { + Lua * L = Lua::find(__L); + int n = L->gettop(); + Handle * s, * d; + int r, l, l_in = -1; + + if (!((n >= 2) && (n <= 3)) || (!L->isnumber(2))) { + L->error("Incorrect arguments to method `Handle::ucl_overlap'"); + } + + s = L->recast<Handle>(1); + l = L->tonumber(2); + if (n == 3) { + l_in = L->tonumber(3); + } + + r = Handle::ucl_overlap(s, l, l_in); + + L->push((lua_Number) r); + + return 1; +} #endif int sLuaHandle::seek(lua_State * __L) { @@ -875,5 +899,6 @@ void LuaHandle::pushconstruct(Lua * L) { #ifdef HAVE_UCL L->declarefunc("ucl_compress", sLuaHandle::ucl_compress); L->declarefunc("ucl_decompress", sLuaHandle::ucl_decompress); + L->declarefunc("ucl_overlap", sLuaHandle::ucl_overlap); #endif } |