Example #1
0
 private static int StaticFunction(UniLua.ILuaState L)
 {
     if (L.CheckNum(2) && L.CheckType <System.Int32, System.Int32>(1))
     {
         var arg1   = L.CheckValue <System.Int32>(1);
         var arg2   = L.CheckValue <System.Int32>(2);
         var result = TestUniToLua.TestClasses.MyClass.StaticFunction(arg1, arg2);
         L.PushValue <System.Int32>(result);
         return(1);
     }
     L.L_Error("call function args is error");
     return(1);
 }
Example #2
0
 private static int MemberFunction(UniLua.ILuaState L)
 {
     if (L.CheckNum(3) && L.CheckType <TestUniToLua.TestClasses.MyClass, System.Int32, System.Int32>(1))
     {
         var obj    = (TestUniToLua.TestClasses.MyClass)L.ToObject(1);
         var arg1   = L.CheckValue <System.Int32>(2);
         var arg2   = L.CheckValue <System.Int32>(3);
         var result = obj.MemberFunction(arg1, arg2);
         L.PushValue <System.Int32>(result);
         return(1);
     }
     L.L_Error("call function args is error");
     return(1);
 }
Example #3
0
        private static int set_staticProperty(UniLua.ILuaState L)
        {
            var value = L.CheckValue <System.Int32>(1);

            TestUniToLua.TestClasses.MyClass.staticProperty = value;
            return(0);
        }
Example #4
0
        private static int set_field(UniLua.ILuaState L)
        {
            var value = L.CheckValue <System.Int32>(1);

            TestUniToLua.TestClasses.MyStaticLib.field = value;
            return(0);
        }
Example #5
0
        private static int set_memberField(UniLua.ILuaState L)
        {
            var obj   = (TestUniToLua.TestClasses.MyClass)L.ToObject(1);
            var value = L.CheckValue <System.Int32>(2);

            obj.memberField = value;
            return(0);
        }
Example #6
0
 private static int Equals(UniLua.ILuaState L)
 {
     if (L.CheckNum(2) && L.CheckType <TestUniToLua.TestClasses.MyClass, System.Object>(1))
     {
         var obj    = (TestUniToLua.TestClasses.MyClass)L.ToObject(1);
         var arg1   = L.CheckValue <System.Object>(2);
         var result = obj.Equals(arg1);
         L.PushValue <System.Boolean>(result);
         return(1);
     }
     L.L_Error("call function args is error");
     return(1);
 }
Example #7
0
 private static int _CreateMyClass(UniLua.ILuaState L)
 {
     if (L.CheckNum(0))
     {
         L.PushValue <TestUniToLua.TestClasses.MyClass>(new TestUniToLua.TestClasses.MyClass());
         return(1);
     }
     else if (L.CheckNum(1) && L.CheckType <TestUniToLua.TestClasses.MyClass>(0))
     {
         var arg1 = L.CheckValue <TestUniToLua.TestClasses.MyClass>(1);
         L.PushValue <TestUniToLua.TestClasses.MyClass>(new TestUniToLua.TestClasses.MyClass(arg1));
         return(1);
     }
     L.L_Error("call function args is error");
     return(1);
 }