Function Entry: GETKWORD

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: GETKWORD

Name

getkword

Class

Function

Syntax

(getkword [msg])

Arguments and Values

  • msg: optional prompt string

Description

Prompts the user for a keyword response.

Return Values

String or nil.

Side Effects

  • prompts the user
  • consumes interactive input

Affected By

  • initget keyword configuration

Compatibility

Closely tied to initget.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • BricsCAD V26: presumed compatible (no contradicting page found).
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.

Notes

  • Autodesk documents that getkword returns nil if the user presses Enter without typing a keyword.
  • Autodesk documents that getkword also returns nil if it is called without a preceding initget that establishes keywords.
  • Autodesk documents that invalid keyword input causes a warning and a re-prompt.
  • Autodesk documents that the user cannot respond with another AutoLISP expression.

clautolisp

clautolisp implementation deviation — not part of the normative specification above. AutoCAD and BricsCAD collect this keyword through the graphical drawing editor's command line (implicitly a GUI). clautolisp has no drawing editor — it writes the prompt to the standard output and reads the answer as one line of text from the standard input (a TUI interaction). Interactively this is the REPL's terminal; for scripted, deterministic runs it is the file attached with --mock-input. A live CAD host, when connected, restores the native GUI behavior. On the TUI the typed line is matched against the keywords set by the preceding initget; a non-matching entry returns nil rather than warning and re-prompting, and (as documented) getkword returns nil when no initget established keywords.