Answer Server 23.4

# 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-2023 Open Text
Version 23.4 | Last updated September 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Answer Server 23.4

Topic Title: userInput