Пример #1
0
	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);
		}
	}
Пример #2
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);
    }
Пример #3
0
 static int Test33(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         TestExport          obj  = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));
         System.Action <int> arg0 = (System.Action <int>)ToLua.CheckDelegate <System.Action <int> >(L, 2);
         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));
     }
 }