# ask

The `ask` method sends a question to the specified answer systems in an Ask action.

## Syntax

    ask(question, systems, maxresults, disambiguation, queryparameters)

## Arguments

Argument | Description
--- | ---
`question` | (string) The question that you want to ask.
`systems` | (string) A table that contains a list of systems that you want to send the question to. This argument is optional. If you do not specify systems, the method sends the question to all configured answer systems.
`maxresults` | (integer) The maximum number of answers to return. This argument is optional. The default value is 1.
`disambiguation` | (Boolean) Set to true to run a disambiguation task when the ask action returns multiple answers. In this case, after the Lua function is complete, the conversation returns a disambiguation task prompt, which overrides any other prompts that you set in the Lua function. This argument is optional, and applies only when you call it from an `invalid_input_lua` function. The default value is false.
`queryparameters` | (table) An optional table of parameters (and associated values) to customize the query. You can use the same parameters that are supported by the Ask action. For example, you could set the `MinScore` parameter to ignore answers that fail to meet a specified score. Parameters not recognized by the Ask action but permitted by AllowedQueryParameters are passed through to child servers (for example an Answer Bank Agentstore).

## Returns

A list of LuaXmlDocument objects that represent the answers.

## Example

    function get_text(document, xpath)
       return document:XPathValue(xpath)
    end

    function plan_holiday(taskUtils)
       local destination = taskUtils:getTaskVar("USER_DESTINATION")
       local answers = taskUtils:ask(string.format("Why do tourists visit %s?", destination), {}, 5, false)
       local text = nil
       if #answers > 0 then
          text = get_text(answers[1], "/answer/text")
       end
       if text ~= nil then
             local prompt1 = LuaUserPrompt:new(text)
             taskUtils:setPrompts(
                {prompt1}
             )
          end
       else
          local prompt2 = LuaUserPrompt:new(string.format("I don't have any useful tourist information about %s.", destination))
          taskUtils:setPrompts(
                {prompt2}
             )
       end
    end

_FT_HTML5_bannerTitle.htm