diff options
| -rw-r--r-- | include/BLua.h | 10 | ||||
| -rw-r--r-- | include/LuaHandle.h | 10 | ||||
| -rw-r--r-- | lib/LuaHandle.cc | 25 | 
3 files changed, 34 insertions, 11 deletions
diff --git a/include/BLua.h b/include/BLua.h index 3d8afe3..5f30199 100644 --- a/include/BLua.h +++ b/include/BLua.h @@ -17,7 +17,7 @@   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */ -/* $Id: BLua.h,v 1.5 2003-12-04 04:09:01 pixel Exp $ */ +/* $Id: BLua.h,v 1.6 2003-12-06 04:26:16 pixel Exp $ */  #ifndef __BLUA_H__
  #define __BLUA_H__
 @@ -49,8 +49,8 @@ class Lua : public Base {      void push(lua_CFunction, int = 0);
      void pop(int = 1);
      void newtable();
 -    void settable(int = -3, bool = false);
 -    void gettable(int = -2, bool = false);
 +    void settable(int = -3, bool raw = false);
 +    void gettable(int = -2, bool raw = false);
      int gettop();
      void error(const String &);
      int type(int = -1);
 @@ -69,8 +69,8 @@ class Lua : public Base {      lua_CFunction tocfunction(int = -1);
      void * touserdata(int = -1);
      Lua * tothread(int = -1);
 -    void load(Handle *, bool = true) throw (GeneralException);
 -    void dump(Handle *, bool = true);
 +    void load(Handle *, bool docall = true) throw (GeneralException);
 +    void dump(Handle *, bool strip = true);
      Lua * thread();
      static Lua * find(lua_State *) throw (GeneralException);
      void showerror();
 diff --git a/include/LuaHandle.h b/include/LuaHandle.h index 8d2a92c..e9f844e 100644 --- a/include/LuaHandle.h +++ b/include/LuaHandle.h @@ -17,7 +17,7 @@   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */ -/* $Id: LuaHandle.h,v 1.3 2003-12-04 04:09:02 pixel Exp $ */ +/* $Id: LuaHandle.h,v 1.4 2003-12-06 04:26:16 pixel Exp $ */  #ifndef __LUAHANDLE_H__
  #define __LUAHANDLE_H__
 @@ -30,7 +30,7 @@  class LuaHandle : public LuaObject {
    public:
 -    LuaHandle(Handle *);
 +      LuaHandle(Handle *);
    protected:
      virtual void pushmembers(Lua *);
      Handle * h;
 @@ -39,7 +39,7 @@ class LuaHandle : public LuaObject {  class LuaInput : public LuaHandle {
    public:
      static void pushconstruct(Lua *);
 -    LuaInput(Input *);
 +      LuaInput(Input *);
    protected:
      virtual void pushmembers(Lua *);
  };
 @@ -47,7 +47,7 @@ class LuaInput : public LuaHandle {  class LuaOutput : public LuaHandle {
    public:
      static void pushconstruct(Lua *);
 -    LuaOutput(Output *);
 +      LuaOutput(Output *);
    protected:
      virtual void pushmembers(Lua *);
  };
 @@ -55,7 +55,7 @@ class LuaOutput : public LuaHandle {  class LuaBuffer : public LuaHandle {
    public:
      static void pushconstruct(Lua *);
 -    LuaBuffer(Buffer *);
 +      LuaBuffer(Buffer *);
    protected:
      virtual void pushmembers(Lua *);
  };
 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;
  | 
