示例#1
0
 static public int LastIndexOf(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             IntList      self = (IntList)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             var ret = self.LastIndexOf(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             IntList      self = (IntList)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             var ret = self.LastIndexOf(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 4)
         {
             IntList      self = (IntList)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             var ret = self.LastIndexOf(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#2
0
        public void TestLastIndexOf()
        {
            IntList list = new IntList();

            for (int j = 0; j < 1000; j++)
            {
                list.Add(j / 2);
            }
            for (int j = 0; j < 1000; j++)
            {
                if (j < 500)
                {
                    Assert.AreEqual(1 + j * 2, list.LastIndexOf(j));
                }
                else
                {
                    Assert.AreEqual(-1, list.IndexOf(j));
                }
            }
        }