Skip to main content

Set Text Content (ui_element.set_text)

This function is available in versions after 20260507

Declaration​

ok, info_or_err = ui_element.set_text(selector_or_element, text [, options ])

Parameters​

  • selector_or_element
    Table. A selector, an element returned by a query, or a coordinate table { x = X, y = Y }.
  • text
    String. Text to set.
  • options
    Optional, table. See Common options.

Returns​

  • ok
    Boolean. true on success, nil on failure.
  • info_or_err
    Table on success, string failure reason on failure.

Description​

Set the content of a text input target to the given text. If the target control does not allow direct text setting, this API may fail.

Example​

local ui_element = require("ui_element")

ui_element.set_text({
title = "Search",
role = "text_field",
}, "XXTouch")