示例#1
0
 public static int ReadUShort(IntPtr ptr)
 {
     try
     {
         ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
         ushort    ret  = self.ReadUnsignedShortInt();
         LuaObject.PushValue(ptr, true);
         LuaObject.PushValue(ptr, ret);
         return(2);
     }
     catch (Exception e)
     {
         return(Error(ptr, e));
     }
 }
示例#2
0
 public static int ReadSByte(IntPtr ptr)
 {
     try
     {
         ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
         sbyte     ret  = self.ReadSignedByte();
         LuaObject.PushValue(ptr, true);
         LuaObject.PushValue(ptr, ret);
         return(2);
     }
     catch (Exception e)
     {
         return(Error(ptr, e));
     }
 }
示例#3
0
 public static int GetData(IntPtr ptr)
 {
     try
     {
         ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
         byte[]    ret  = self.GetData();
         LuaObject.PushValue(ptr, true);
         LuaObject.PushValue(ptr, ret);
         return(2);
     }
     catch (Exception e)
     {
         return(Error(ptr, e));
     }
 }
示例#4
0
 public static int SetPosition(IntPtr ptr)
 {
     try
     {
         ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
         int       v;
         CheckType(ptr, 2, out v);
         self.Position = v;
         LuaObject.PushValue(ptr, true);
         return(1);
     }
     catch (Exception e)
     {
         return(Error(ptr, e));
     }
 }
示例#5
0
 public static int WriteBytes(IntPtr ptr)
 {
     try
     {
         ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
         byte[]    a1;
         LuaObject.CheckArray(ptr, 2, out a1);
         self.WriteBytes(a1);
         LuaObject.PushValue(ptr, true);
         return(1);
     }
     catch (Exception e)
     {
         return(Error(ptr, e));
     }
 }
示例#6
0
 public static int WriteInt48(IntPtr ptr)
 {
     try
     {
         ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
         long      a1;
         CheckType(ptr, 2, out a1);
         self.WriteInt48(a1);
         LuaObject.PushValue(ptr, true);
         return(1);
     }
     catch (Exception e)
     {
         return(Error(ptr, e));
     }
 }
示例#7
0
 public static int Read(IntPtr ptr)
 {
     try
     {
         ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
         byte[]    a1;
         CheckType(ptr, 2, out a1);
         self.Read(ref a1);
         LuaObject.PushValue(ptr, true);
         LuaObject.PushValue(ptr, a1);
         return(2);
     }
     catch (Exception e)
     {
         return(Error(ptr, e));
     }
 }
示例#8
0
        public static int SetData(IntPtr ptr)
        {
            try
            {
                int argc = LuaNativeMethods.lua_gettop(ptr);
                if (argc == 2)
                {
                    ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
                    byte[]    a1;
                    LuaObject.CheckArray(ptr, 2, out a1);
                    self.SetData(a1);
                    LuaObject.PushValue(ptr, true);
                    return(1);
                }
                else if (argc == 4)
                {
                    ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr);
                    byte[]    a1;
                    LuaObject.CheckArray(ptr, 2, out a1);
                    int a2;
                    CheckType(ptr, 3, out a2);
                    int a3;
                    CheckType(ptr, 4, out a3);
                    self.SetData(a1, a2, a3);
                    LuaObject.PushValue(ptr, true);
                    return(1);
                }

                LuaObject.PushValue(ptr, false);
                LuaNativeMethods.lua_pushstring(ptr, "No matched override function SetData to call");
                return(2);
            }
            catch (Exception e)
            {
                return(Error(ptr, e));
            }
        }