Handles the Lua console.
More...
#include "console.h"
#include "array.h"
#include "conf.h"
#include "font.h"
#include "log.h"
#include "menu.h"
#include "naev.h"
#include "ndata.h"
#include "nlua.h"
#include "nlua_bkg.h"
#include "nlua_camera.h"
#include "nlua_cli.h"
#include "nlua_colour.h"
#include "nlua_linopt.h"
#include "nlua_music.h"
#include "nlua_tex.h"
#include "nlua_tk.h"
#include "nluadef.h"
#include "nstring.h"
#include "toolkit.h"
Go to the source code of this file.
|
| static int | cli_script (lua_State *L) |
| | Would be like "dofile" from the base Lua lib.
|
| static int | cli_keyhandler (unsigned int wid, SDL_Keycode key, SDL_Keymod mod, int isrepeat) |
| | Key handler for the console window.
|
| static void | cli_render (double bx, double by, double w, double h, void *data) |
| | Render function for the custom widget.
|
| static int | cli_printCore (lua_State *L, int cli_only, int escape) |
| | Back end for the Lua print functionality.
|
| static void | cli_addMessage (const char *msg) |
| | Adds a message to the buffer.
|
| static void | cli_addMessageMax (const char *msg, const int l) |
| | Adds a message to the buffer.
|
| void | cli_tabComplete (unsigned int wid) |
| | Basic tab completion for console.
|
| static int | cli_initLua (void) |
| static char * | cli_escapeString (int *len_out, const char *s, int len) |
| void | cli_printCoreString (const char *s, int escape) |
| | Prints a string.
|
| int | cli_warn (lua_State *L) |
| | Barebones warn implementation for Lua, allowing scripts to print warnings to stderr.
|
| int | cli_print (lua_State *L) |
| | Replacement for the internal Lua print to print to both the console and the terminal.
|
| int | cli_printRaw (lua_State *L) |
| | Prints raw markup to the console.
|
| int | cli_init (void) |
| | Initializes the CLI environment.
|
| void | cli_exit (void) |
| | Destroys the CLI environment.
|
| static void | cli_input (unsigned int wid, const char *unused) |
| | Handles the CLI input.
|
| void | cli_open (void) |
| | Opens the console.
|
| int | cli_isOpen (void) |
Handles the Lua console.
Definition in file console.c.
◆ BUTTON_HEIGHT
Button height.
Definition at line 43 of file console.c.
◆ BUTTON_WIDTH
◆ CLI_HEIGHT
| #define CLI_HEIGHT ( SCREEN_H - 100 ) |
Console height.
Definition at line 60 of file console.c.
◆ CLI_MAX_INPUT
◆ CLI_MAX_LINES
| #define CLI_MAX_LINES ( cli_max_lines ) |
Number of lines displayed at once
Definition at line 70 of file console.c.
◆ CLI_WIDTH
| #define CLI_WIDTH ( SCREEN_W - 100 ) |
Console width.
Definition at line 59 of file console.c.
◆ cli_addMessage()
| void cli_addMessage |
( |
const char * | msg | ) |
|
|
static |
Adds a message to the buffer.
- Parameters
-
Definition at line 248 of file console.c.
◆ cli_addMessageMax()
| void cli_addMessageMax |
( |
const char * | msg, |
|
|
const int | l ) |
|
static |
Adds a message to the buffer.
- Parameters
-
| msg | Message to add. |
| l | Max message length. |
Definition at line 265 of file console.c.
◆ cli_escapeString()
| char * cli_escapeString |
( |
int * | len_out, |
|
|
const char * | s, |
|
|
int | len ) |
|
static |
◆ cli_exit()
Destroys the CLI environment.
Definition at line 528 of file console.c.
◆ cli_init()
Initializes the CLI environment.
Definition at line 508 of file console.c.
◆ cli_initLua()
◆ cli_input()
| void cli_input |
( |
unsigned int | wid, |
|
|
const char * | unused ) |
|
static |
Handles the CLI input.
- Parameters
-
| wid | Window receiving the input. |
| unused | Unused. |
Definition at line 555 of file console.c.
◆ cli_isOpen()
◆ cli_keyhandler()
| int cli_keyhandler |
( |
unsigned int | wid, |
|
|
SDL_Keycode | key, |
|
|
SDL_Keymod | mod, |
|
|
int | isrepeat ) |
|
static |
Key handler for the console window.
Definition at line 301 of file console.c.
◆ cli_open()
Opens the console.
Definition at line 662 of file console.c.
◆ cli_print()
| int cli_print |
( |
lua_State * | L | ) |
|
Replacement for the internal Lua print to print to both the console and the terminal.
Definition at line 178 of file console.c.
◆ cli_printCore()
| int cli_printCore |
( |
lua_State * | L, |
|
|
int | cli_only, |
|
|
int | escape ) |
|
static |
Back end for the Lua print functionality.
Definition at line 130 of file console.c.
◆ cli_printCoreString()
| void cli_printCoreString |
( |
const char * | s, |
|
|
int | escape ) |
◆ cli_printRaw()
| int cli_printRaw |
( |
lua_State * | L | ) |
|
Prints raw markup to the console.
- Parameters
-
- Returns
- Number of variables on the Lua State stack.
Lua function: printRaw
Definition at line 188 of file console.c.
◆ cli_render()
| void cli_render |
( |
double | bx, |
|
|
double | by, |
|
|
double | w, |
|
|
double | h, |
|
|
void * | data ) |
|
static |
Render function for the custom widget.
Definition at line 279 of file console.c.
◆ cli_script()
| int cli_script |
( |
lua_State * | L | ) |
|
|
static |
Would be like "dofile" from the base Lua lib.
Definition at line 196 of file console.c.
◆ cli_tabComplete()
| void cli_tabComplete |
( |
unsigned int | wid | ) |
|
Basic tab completion for console.
Definition at line 382 of file console.c.
◆ cli_warn()
| int cli_warn |
( |
lua_State * | L | ) |
|
Barebones warn implementation for Lua, allowing scripts to print warnings to stderr.
- Parameters
-
- Returns
- Number of variables on the Lua State stack.
Lua function: warn
Definition at line 169 of file console.c.
◆ cli_buffer
◆ cli_env
| nlua_env cli_env = LUA_NOREF |
|
static |
◆ cli_firstline
Original CLI: Is this the first line?
Definition at line 66 of file console.c.
◆ cli_firstOpen
First time opening.
Definition at line 65 of file console.c.
◆ cli_font
CLI font to use.
Definition at line 52 of file console.c.
◆ cli_height
◆ cli_history
Position in history.
Definition at line 63 of file console.c.
◆ cli_max_lines
◆ cli_methods
| const luaL_Reg cli_methods[] |
|
static |
Initial value:= {
{ NULL, NULL } }
int cli_warn(lua_State *L)
Barebones warn implementation for Lua, allowing scripts to print warnings to stderr.
static int cli_script(lua_State *L)
Would be like "dofile" from the base Lua lib.
Console only functions.
Definition at line 76 of file console.c.
◆ cli_prompt
Prompt string (allocated).
Definition at line 62 of file console.c.
◆ cli_scroll_pos
Position in scrolling through output
Definition at line 64 of file console.c.
◆ cli_thread
| lua_State* cli_thread = NULL |
|
static |
REPL coroutine's thread
Definition at line 49 of file console.c.
◆ cli_thread_ref
Initial value:Reference keeping cli_thread alive
Definition at line 50 of file console.c.