diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/LuaHandle.cc | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index 1bd39d3..e336f54 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -64,6 +64,7 @@ class sLuaHandle : public Base { static int bnewindex(lua_State * L); static int bseek(lua_State * L); static int btell(lua_State * L); + static int breset(lua_State * L); static int exists(lua_State * L); static int get_nb_handles(lua_State * L); static int get_nb_input(lua_State * L); @@ -692,6 +693,20 @@ int sLuaHandle::bseek(lua_State * __L) { return 1; } +int sLuaHandle::breset(lua_State * __L) { + Lua * L = Lua::find(__L); + int n = L->gettop(); + Buffer * h; + + if (n != 1) { + L->error("Incorrect arguments to method `Buffer::reset'"); + } + + h = (Buffer *) LuaObject::getme(L); + h->reset(); + return 0; +} + int sLuaHandle::exists(lua_State * __L) { Lua * L = Lua::find(__L); int n = L->gettop(); @@ -733,6 +748,7 @@ void LuaBuffer::pushmembers(Lua * L) { pushmeta(L, "__newindex", sLuaHandle::bnewindex); pushit(L, "wtell", sLuaHandle::btell); pushit(L, "wseek", sLuaHandle::bseek); + pushit(L, "reset", sLuaHandle::breset); L->push("__handletype"); L->push("Buffer"); L->settable(-3, true); @@ -741,11 +757,11 @@ void LuaBuffer::pushmembers(Lua * L) { void LuaHandle::pushmembers(Lua * L) { pushme(L, h, "Handle"); - pushit(L, "read", &sLuaHandle::read); - pushit(L, "write", &sLuaHandle::write); + pushit(L, "read", sLuaHandle::read); + pushit(L, "write", sLuaHandle::write); - pushit(L, "readstring", &sLuaHandle::readstring); - pushit(L, "writestring", &sLuaHandle::writestring); + pushit(L, "readstring", sLuaHandle::readstring); + pushit(L, "writestring", sLuaHandle::writestring); pushit(L, "readU8", sLuaHandle::readU8); pushit(L, "readU16", sLuaHandle::readU16); @@ -764,7 +780,7 @@ void LuaHandle::pushmembers(Lua * L) { pushit(L, "isclosed", sLuaHandle::isclosed); pushit(L, "isnonblock", sLuaHandle::isnonblock); pushit(L, "canread", sLuaHandle::canread); - pushit(L, "canwrite", sLuaHandle::canwatch); + pushit(L, "canwrite", sLuaHandle::canwrite); pushit(L, "canseek", sLuaHandle::canseek); pushit(L, "canwatch", sLuaHandle::canwatch); |