Extension-Druid/api/components/custom/rich_input_api.md
2025-03-14 20:29:05 +02:00

2.8 KiB

druid.rich_input API

at /druid/custom/rich_input/rich_input.lua

Functions

Fields

init


rich_input:init(template, nodes)
  • Parameters:
    • template (string): The template string name
    • nodes (table): Nodes table from gui.clone_tree

on_input


rich_input:on_input([action_id], [action])
  • Parameters:

    • [action_id] (any):
    • [action] (any):
  • Returns:

    • `` (boolean):

set_placeholder


rich_input:set_placeholder(placeholder_text)

Set placeholder text

  • Parameters:

    • placeholder_text (string): The placeholder text
  • Returns:

    • `` (druid.rich_input):

select


rich_input:select()

Select input field

set_text


rich_input:set_text(text)

Set input field text

  • Parameters:

    • text (string): The input text
  • Returns:

    • self (druid.rich_input): Current instance

set_font


rich_input:set_font(font)

Set input field font

  • Parameters:

    • font (hash): The font hash
  • Returns:

    • self (druid.rich_input): Current instance

get_text


rich_input:get_text()

Set input field text

  • Returns:
    • `` (string):

set_allowed_characters


rich_input:set_allowed_characters(characters)

Set allowed charaters for input field. See: https://defold.com/ref/stable/string/ ex: [%a%d] for alpha and numeric

  • Parameters:

    • characters (string): Regulax exp. for validate user input
  • Returns:

    • Current (druid.rich_input): instance

Fields

  • root (node)

  • input (druid.input)

  • cursor (node)

  • cursor_text (node)

  • cursor_position (vector3)

  • druid (druid.instance)

  • is_lshift (boolean)

  • is_lctrl (boolean)

  • is_button_input_enabled (unknown)

  • drag (druid.drag)

  • placeholder (druid.text)

  • text_position (unknown)