static int Send(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         ShibaInu.HttpRequest obj = (ShibaInu.HttpRequest)ToLua.CheckObject <ShibaInu.HttpRequest>(L, 1);
         obj.Send();
         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);
        }