Open topic with navigation

# ask

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

## Syntax

    ask(question, systems, maxresults, disambiguation)

## 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.

## 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

© 2016-2018 EntIT Software LLC, a Micro Focus company | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm