Esempio n. 1
0
    static int set_OnClick(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            TestExport    obj       = (TestExport)o;
            System.Action arg0      = null;
            LuaTypes      funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Action)ToLua.CheckObject(L, 2, typeof(System.Action));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Action), func) as System.Action;
            }

            obj.OnClick = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index OnClick on a nil value" : e.Message));
        }
    }
	static int TestByteBuffer(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			TestExport.TestBuffer arg0 = null;
			LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

			if (funcType2 != LuaTypes.LUA_TFUNCTION)
			{
				 arg0 = (TestExport.TestBuffer)ToLua.CheckObject(L, 2, typeof(TestExport.TestBuffer));
			}
			else
			{
				LuaFunction func = ToLua.ToLuaFunction(L, 2);
				arg0 = DelegateFactory.CreateDelegate(typeof(TestExport.TestBuffer), func) as TestExport.TestBuffer;
			}

			obj.TestByteBuffer(arg0);
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 3
0
    private static int Test33(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            TestExport   testExport = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
            Action <int> ev         = null;
            LuaTypes     luaTypes   = LuaDLL.lua_type(L, 2);
            if (luaTypes != LuaTypes.LUA_TFUNCTION)
            {
                ev = (Action <int>)ToLua.CheckObject(L, 2, typeof(Action <int>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                ev = (DelegateFactory.CreateDelegate(typeof(Action <int>), func) as Action <int>);
            }
            int n = testExport.Test33(ref ev);
            LuaDLL.lua_pushinteger(L, n);
            ToLua.Push(L, ev);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Esempio n. 4
0
    private static int set_OnRefEvent(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            TestExport testExport = (TestExport)obj;
            LuaTypes   luaTypes   = LuaDLL.lua_type(L, 2);
            TestExport.TestRefEvent onRefEvent;
            if (luaTypes != LuaTypes.LUA_TFUNCTION)
            {
                onRefEvent = (TestExport.TestRefEvent)ToLua.CheckObject(L, 2, typeof(TestExport.TestRefEvent));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                onRefEvent = (DelegateFactory.CreateDelegate(typeof(TestExport.TestRefEvent), func) as TestExport.TestRefEvent);
            }
            testExport.OnRefEvent = onRefEvent;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index OnRefEvent on a nil value");
        }
        return(result);
    }
Esempio n. 5
0
    private static int set_Item(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 1 && TypeChecker.CheckTypes(L, 1, typeof(double)))
            {
                double item = LuaDLL.lua_tonumber(L, 1);
                int    n    = TestExport.set_Item(item);
                LuaDLL.lua_pushinteger(L, n);
                result = 1;
            }
            else if (num == 3 && TypeChecker.CheckTypes(L, 1, typeof(TestExport), typeof(int), typeof(int)))
            {
                TestExport testExport = (TestExport)ToLua.ToObject(L, 1);
                int        pos        = (int)LuaDLL.lua_tonumber(L, 2);
                int        value      = (int)LuaDLL.lua_tonumber(L, 3);
                testExport[pos] = value;
                result          = 0;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.set_Item");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Esempio n. 6
0
    private static int TestByteBuffer(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            TestExport            testExport = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
            LuaTypes              luaTypes   = LuaDLL.lua_type(L, 2);
            TestExport.TestBuffer tb;
            if (luaTypes != LuaTypes.LUA_TFUNCTION)
            {
                tb = (TestExport.TestBuffer)ToLua.CheckObject(L, 2, typeof(TestExport.TestBuffer));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                tb = (DelegateFactory.CreateDelegate(typeof(TestExport.TestBuffer), func) as TestExport.TestBuffer);
            }
            testExport.TestByteBuffer(tb);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
	static int Test33(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			System.Action<int> arg0 = null;
			LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

			if (funcType2 != LuaTypes.LUA_TFUNCTION)
			{
				 arg0 = (System.Action<int>)ToLua.CheckObject(L, 2, typeof(System.Action<int>));
			}
			else
			{
				LuaFunction func = ToLua.ToLuaFunction(L, 2);
				arg0 = DelegateFactory.CreateDelegate(typeof(System.Action<int>), func) as System.Action<int>;
			}

			int o = obj.Test33(ref arg0);
			LuaDLL.lua_pushinteger(L, o);
			ToLua.Push(L, arg0);
			return 2;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 8
0
    static int _set_this(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3)
            {
                TestExport obj  = (TestExport)ToLua.CheckObject <TestExport>(L, 1);
                int        arg0 = (int)LuaDLL.luaL_checkinteger(L, 2);
                int        arg1 = (int)LuaDLL.luaL_checkinteger(L, 3);
                obj[arg0] = arg1;
                return(0);
            }
            else if (count == 4)
            {
                TestExport obj  = (TestExport)ToLua.CheckObject <TestExport>(L, 1);
                char       arg0 = (char)LuaDLL.luaL_checkinteger(L, 2);
                int        arg1 = (int)LuaDLL.luaL_checkinteger(L, 3);
                int        arg2 = (int)LuaDLL.luaL_checkinteger(L, 4);
                obj[arg0, arg1] = arg2;
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to operator method: TestExport.this"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
	static int set_OnRefEvent(IntPtr L)
	{
		object o = null;

		try
		{
			o = ToLua.ToObject(L, 1);
			TestExport obj = (TestExport)o;
			TestExport.TestRefEvent arg0 = null;
			LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

			if (funcType2 != LuaTypes.LUA_TFUNCTION)
			{
				 arg0 = (TestExport.TestRefEvent)ToLua.CheckObject(L, 2, typeof(TestExport.TestRefEvent));
			}
			else
			{
				LuaFunction func = ToLua.ToLuaFunction(L, 2);
				arg0 = DelegateFactory.CreateDelegate(typeof(TestExport.TestRefEvent), func) as TestExport.TestRefEvent;
			}

			obj.OnRefEvent = arg0;
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index OnRefEvent on a nil value" : e.Message);
		}
	}
Esempio n. 10
0
    static int _get_this(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                TestExport obj  = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
                int        arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                int        o    = obj[arg0];
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3)
            {
                TestExport obj  = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
                char       arg0 = (char)LuaDLL.luaL_checknumber(L, 2);
                int        arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
                int        o    = obj[arg0, arg1];
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to operator method: TestExport.this"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
	static int set_Item(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(double)))
			{
				double arg0 = (double)LuaDLL.lua_tonumber(L, 1);
				int o = TestExport.set_Item(arg0);
				LuaDLL.lua_pushinteger(L, o);
				return 1;
			}
			else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(TestExport), typeof(int), typeof(int)))
			{
				TestExport obj = (TestExport)ToLua.ToObject(L, 1);
				int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
				int arg1 = (int)LuaDLL.lua_tonumber(L, 3);
				obj[arg0] = arg1;
				return 0;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.set_Item");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 12
0
    static int get_Item(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes <string>(L, 1))
            {
                string arg0 = ToLua.ToString(L, 1);
                int    o    = TestExport.get_Item(arg0);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <double>(L, 1))
            {
                double arg0 = (double)LuaDLL.lua_tonumber(L, 1);
                int    o    = TestExport.get_Item(arg0);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 2)
            {
                TestExport obj  = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
                int        arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                int        o    = obj[arg0];
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <TestExport, char, int>(L, 1))
            {
                TestExport obj  = (TestExport)ToLua.ToObject(L, 1);
                char       arg0 = (char)LuaDLL.lua_tonumber(L, 2);
                int        arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                int        o    = obj[arg0, arg1];
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes <int, int, int>(L, 1))
            {
                int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
                int arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                int o    = TestExport.get_Item(arg0, arg1, arg2);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: TestExport.get_Item"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 13
0
    public static int  obj_hash(long L)
    {
        TestExport obj = FCGetObj.GetObj <TestExport>(L);

        if (obj != null)
        {
            return(obj.GetHashCode());
        }
        return(0);
    }
	static int TestReflection(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 0);
			TestExport.TestReflection();
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
    void Start()
    {
        LuaState state = new LuaState();

        state.Start();
        LuaBinder.Bind(state);
        state.DoString(script, "TestOverload.cs");

        TestExport  to   = new TestExport();
        LuaFunction func = state.GetFunction("Test");

        func.Call(to);
        state.Dispose();
    }
Esempio n. 16
0
    void Awake()
    {
        LuaState state = new LuaState();

        state.Start();

        Bind(state);
        state.DoString(script, "TestOverride.cs");

        TestExport  to   = new TestExport();
        LuaFunction func = state.GetFunction("Test");

        func.Call(to);
    }
	static int DoClick(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			obj.DoClick();
			return 0;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 18
0
 public static int get_materials_wrap(long L)
 {
     try
     {
         long       nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L);
         TestExport ret      = get_obj(nThisPtr);
         FCCustomParam.ReturnArray(ret.materials, L);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
Esempio n. 19
0
 static int TestRefGameObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject <UnityEngine.GameObject>(L, 1);
         TestExport.TestRefGameObject(ref arg0);
         ToLua.PushSealed(L, arg0);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 20
0
    void  Test()
    {
        TestExport ret = this;
        long       v   = FCGetObj.PushObj(TestExport.onPostRender);

        FCDll.PushCallParam(v);
        int[] buffer = new int[10];
        unsafe
        {
            fixed(void *p = buffer)
            {
            }
        }
        //this.GetRefList(ref arg0);
    }
Esempio n. 21
0
 static int TestByteBuffer(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         TestExport            obj  = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
         TestExport.TestBuffer arg0 = (TestExport.TestBuffer)ToLua.CheckDelegate <TestExport.TestBuffer>(L, 2);
         obj.TestByteBuffer(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 22
0
    public static bool  obj_equal(long L, long R)
    {
        TestExport left  = FCGetObj.GetObj <TestExport>(L);
        TestExport right = FCGetObj.GetObj <TestExport>(R);

        if (left != null)
        {
            return(left.Equals(right));
        }
        if (right != null)
        {
            return(right.Equals(left));
        }
        return(true);
    }
	static int TestRefGameObject(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 1);
			UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject));
			TestExport.TestRefGameObject(ref arg0);
			ToLua.Push(L, arg0);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 24
0
 int set_onOwnPostRender_Wrap(long L)
 {
     try
     {
         onPostRender_deletate func = FCDelegateMng.Instance.GetDelegate <onPostRender_deletate>(L);
         long       nThisPtr        = FCLibHelper.fc_get_inport_obj_ptr(L);
         TestExport ret             = get_obj(nThisPtr);
         ret.onOwnPostRender = func.CallFunc;
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
	static int TestCheckParamString(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			string[] arg0 = ToLua.CheckParamsString(L, 2, count - 1);
			string o = obj.TestCheckParamString(arg0);
			LuaDLL.lua_pushstring(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
	static int TestCheckParamNumber(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			int[] arg0 = ToLua.CheckParamsNumber<int>(L, 2, count - 1);
			int o = obj.TestCheckParamNumber(arg0);
			LuaDLL.lua_pushinteger(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
	static int TestEnum(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			TestExport.Space arg0 = (TestExport.Space)ToLua.CheckObject(L, 2, typeof(TestExport.Space));
			int o = obj.TestEnum(arg0);
			LuaDLL.lua_pushinteger(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
	static int TestGeneric(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			UnityEngine.Component arg0 = (UnityEngine.Component)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Component));
			int o = obj.TestGeneric(arg0);
			LuaDLL.lua_pushinteger(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 29
0
 static int _get_this(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         TestExport obj  = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
         int        arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         int        o    = obj[arg0];
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
	static int TestChar(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			TestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
			char arg0 = (char)LuaDLL.luaL_checknumber(L, 2);
			int o = obj.Test(arg0);
			LuaDLL.lua_pushinteger(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Esempio n. 31
0
    void Awake()
    {
        LuaState state = new LuaState();
        state.Start();

        Bind(state);
        state.DoString(script, "TestOverride.cs");

        TestExport to = new TestExport();
        LuaFunction func = state.GetFunction("Test");
        func.Call(to);
    }
Esempio n. 32
0
    static int _CreateTestExport(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                TestExport obj = new TestExport();
                ToLua.PushObject(L, obj);
                return 1;
            }
            else
            {
                return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: TestExport.New");
            }
        }
        catch(Exception e)
        {
            return LuaDLL.toluaL_exception(L, e);
        }
    }
    static int _CreateTestExport(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                TestExport obj = new TestExport();
                ToLua.PushObject(L, obj);
                return 1;
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Vector3)))
            {
                UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1);
                TestExport obj = new TestExport(arg0);
                ToLua.PushObject(L, obj);
                return 1;
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Vector3[])))
            {
                UnityEngine.Vector3[] arg0 = ToLua.CheckObjectArray<UnityEngine.Vector3>(L, 1);
                TestExport obj = new TestExport(arg0);
                ToLua.PushObject(L, obj);
                return 1;
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Vector3), typeof(string)))
            {
                UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1);
                string arg1 = ToLua.CheckString(L, 2);
                TestExport obj = new TestExport(arg0, arg1);
                ToLua.PushObject(L, obj);
                return 1;
            }
            else
            {
                return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: TestExport.New");
            }
        }
        catch(Exception e)
        {
            return LuaDLL.toluaL_exception(L, e);
        }
    }