示例#1
0
文件: HttpLua.cpp 项目: txal/XProject
//HTTP响应
static int HttpResponse(lua_State* pState)
{
	lua_settop(pState, 2);
	if (!lua_islightuserdata(pState, 1))
	{
		return LuaWrapper::luaM_error(pState, "参数1错误");
	}
	struct mg_connection* c = (struct mg_connection*)lua_topointer(pState, 1);
	const char* d = luaL_checkstring(pState, 2);

	HTTPMSG* pMsg = XNEW(HTTPMSG)();
	pMsg->c = c;
	pMsg->data = std::string(d);
	goHttpServer.Response(pMsg);
	return 0;
}