term.input.prompt — Lilush API

←index

← term.input

Overview

Input prompt display with optional configurable blocks.

Functions

NameSignature
prompt:getprompt:get() -> prompt
prompt:setprompt:set(options)
prompt:get_blocksprompt:get_blocks() -> blocks
prompt:set_blocksprompt:set_blocks(new_blocks)
newnew(prompt_module_name) -> prompt

prompt:get() -> prompt

Return the current prompt string

prompt:set(options)

Update prompt state from an options table

Merges all keys from options directly into the prompt's __state. The built-in default prompt uses prompt (display string) and blocks (list of block names). Custom prompt modules may also accept lines (total line count) and line (current line index) to render multi-line indicators.

prompt:get_blocks() -> blocks

Return the prompt's block list

prompt:set_blocks(new_blocks)

Replace the prompt's block list

new(prompt_module_name) -> prompt

Create a new prompt instance from a named module

If prompt_module_name is "default", returns a built-in prompt with get, set, get_blocks, and set_blocks methods. Otherwise loads the named module and calls its new(). Returns nil if the module is not available.