Lua primitives: history_file()
If you configure a file with history_file then any input you make to the prompt() function will persist across sessions.
The history file is not currently capped at any particular size, but this might change in the future.
This function has been available since version 0.18.
See also prompt.