static int SetLuaCallback(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ShibaInu.HttpRequest obj  = (ShibaInu.HttpRequest)ToLua.CheckObject <ShibaInu.HttpRequest>(L, 1);
         LuaFunction          arg0 = ToLua.CheckLuaFunction(L, 2);
         obj.SetLuaCallback(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #2
0
        /// <summary>
        /// 发送一条 http 请求,并返回对应 HttpRequest 实例
        /// </summary>
        /// <returns>The http request.</returns>
        /// <param name="url">URL.</param>
        /// <param name="callback">Callback.</param>
        /// <param name="postData">Post data.</param>
        public static HttpRequest SendHttpRequest(string url, LuaFunction callback, string postData)
        {
            HttpRequest req = new HttpRequest();

            req.url = url;

            if (postData != null)
            {
                req.method   = HttpRequestMethod.POST;
                req.postData = postData;
            }

            if (callback != null)
            {
                req.SetLuaCallback(callback);
            }

            req.Send();
            return(req);
        }