Open topic with navigation

# userInput

The `userInput` method gets the input text that the user supplied at a particular stage of the conversation.

NOTE:

The history table from `getTranscript` does not include the current user text. To retrieve the current user text, use the getUserText method.

## Syntax

    userInput()

## Returns

(string) The user text for the specified stage of the conversation, or `nil` for the first history stage if the user did not say anything to start the conversation.

## Examples

    for i = #history, 1, -1 do
       local usersaid = history[i]:userInput()
       if usersaid ~= nil then
          return string.format("The last thing you said was \"%s\"", usersaid)
       end
    end
    return string.format("You haven't said anything yet (apart from \"%s\").", taskUtils:getUserText() )

This example returns the last thing the user said, or returns You haven't said anything yet (apart from currentUserText) , where currentUserText is the text that the user provided before Answer Server called the Lua script.

    for i,s in ipairs(history) do
       local usersaid = s:userInput()
       if usersaid ~= nil then
          return string.format("The first thing you said was \"%s\"", usersaid)
       end
    end

This example returns the first thing the user said.

© Copyright 2016-2019 Micro Focus or one of its affiliates | Send documentation feedback 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