-
Notifications
You must be signed in to change notification settings - Fork 1
Lua API
This is the documentation of the globals provided to the Lua environment when you run the lua command in nds-shell.
A table containing libnds functions. For all functions listed below, refer to libnds documentation. They are direct bindings with no modification.
setBrightness(screen: number, level: number)pmMainLoop(): booleanthreadYield()
Asynchronous command-line interface prompt, taking input from the keypad (physical buttons) and libnds virtual keyboard. Provides:
- a visible, movable cursor that can edit the line at any position
- input line history with arrow-key & d-pad button navigation
A new CliPrompt object with default prompt string (> ) and output stream (std::cout).
-
prompt: The string to print before processing keyboard input.
A new CliPrompt object with the provided prompt string and output stream set to the lua command's output stream (the console it was run on).
Write-only property. Sets the prompt string.
Write-only property. Sets the output stream. Must be an std::ostream.
Read-only property. Gets the current input string.
Prints the prompt string, and optionally the current input.
-
withInput: Boolean specifying whether the current input should be printed after the prompt string
Resets internal state necessary to start reading in characters for a "new line" of input. In particular, it clears the input string. You should call this when you want to reuse the prompt for multiple lines of input, after you are finished with what's currently in the input.
Updates the prompt based on any detected user input (keyboard/keypad), and prints to the output stream reflecting the input buffer. You must call this (usually in a loop) to receive input and see it on the console.
Read-only property. Returns whether the Enter key was pressed on the last call to update().
Read-only property. Returns whether the "fold" key (the key in the Esc key's spot on the libnds default keyboard) was pressed on the last call to update().
Read-only property. Returns the current line history as an array of strings.
Replaces the line history with that from the file at filename.
-
filename: Path to file to use as history file.
Clears the line history.
A fetch()-like API for asynchronous HTTP(S) requests.
-
url: String containing endpoint URL -
opts: Table of the form:{ method = 'HTTP method string (optional)', body = 'HTTP request body (optional)', headers = { -- Optional table of headers ['Key'] = 'Value' }, } -
on_complete: Function taking the parameters(code, body, error), wherecodeis the HTTP response code,bodyis the HTTP response body (may be empty), anderroris a libcurl error string if an error occurred ornilif not.