summaryrefslogtreecommitdiff
path: root/lib/LuaHandle.cc
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-06 04:26:16 +0000
committerpixel <pixel>2003-12-06 04:26:16 +0000
commite76bc2b8b3ebe01872fecd4f5f2344ee9b998f6d (patch)
tree4a6a965b82b592ff6551cb51c8004daa9e9d0575 /lib/LuaHandle.cc
parent502447d949ac09089a08ee1a2dad251fea4ae26a (diff)
Having LUA now in cd-tool! Yay!
Diffstat (limited to 'lib/LuaHandle.cc')
-rw-r--r--lib/LuaHandle.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc
index c332b0a..487470d 100644
--- a/lib/LuaHandle.cc
+++ b/lib/LuaHandle.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: LuaHandle.cc,v 1.5 2003-12-04 04:09:02 pixel Exp $ */
+/* $Id: LuaHandle.cc,v 1.6 2003-12-06 04:26:17 pixel Exp $ */
#include "LuaHandle.h"
@@ -30,6 +30,7 @@ class sLuaHandle : public Base {
public:
static int newinput(lua_State * L);
static int newoutput(lua_State * L);
+ static int newbuffer(lua_State * L);
static int read(lua_State * L);
static int readstring(lua_State * L);
static int readU8(lua_State * L);
@@ -89,6 +90,10 @@ void LuaOutput::pushconstruct(Lua * L) {
L->declarefunc("Output", sLuaHandle::newoutput);
}
+void LuaBuffer::pushconstruct(Lua * L) {
+ L->declarefunc("Buffer", sLuaHandle::newbuffer);
+}
+
int sLuaHandle::newinput(lua_State * _L) {
Lua * L = Lua::find(_L);
int n = L->gettop();
@@ -117,6 +122,24 @@ int sLuaHandle::newoutput(lua_State * _L) {
return 1;
}
+int sLuaHandle::newbuffer(lua_State * _L) {
+ Lua * L = Lua::find(_L);
+ int n = L->gettop();
+ bool seekable = false;
+
+ if ((n > 1) || ((n == 1) && (!L->isboolean()))) {
+ L->error("Incorrect arguments to constructor `Buffer'");
+ }
+
+ if (n == 1)
+ seekable = L->toboolean();
+
+ LuaBuffer o(new Buffer(seekable));
+ o.pushdestruct(L);
+
+ return 1;
+}
+
int sLuaHandle::read(lua_State * _L) {
Lua * L = Lua::find(_L);
int n = L->gettop(), i;