Answer Server 25.3
Answer Server Help

# 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-2025 Open Text
Version 25.3 | Last updated July 2025

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 MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Answer Server 25.3

Topic Title: userInput