71 lua_State *lua_state = mod_data->
lua_state;
76 if (luaL_dostring(lua_state, line->
dptr) != LUA_OK)
79 buf_printf(err,
"%s: %s", line->
dptr, lua_tostring(lua_state, -1));
81 lua_pop(lua_state, 1);
116 lua_State *lua_state = mod_data->
lua_state;
134 if (luaL_dofile(lua_state,
buf_string(token)) != LUA_OK)
136 mutt_error(
_(
"Couldn't source lua source: %s"), lua_tostring(lua_state, -1));
137 lua_pop(lua_state, 1);
154 N_(
"Run a Lua expression or call a Lua function"),
155 N_(
"lua <lua-command>"),
156 "optionalfeatures.html#lua" },
158 N_(
"Execute a Lua script file"),
159 N_(
"lua-source <filename>"),
160 "optionalfeatures.html#lua" },
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
@ CF_NONE
No flags are set.
@ CMD_LUA_SOURCE
:lua-source
CommandResult
Error codes for command_t parse functions.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Convenience wrapper for the core headers.
enum CommandResult parse_lua_source(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'lua-source' command - Implements Command::parse() -.
enum CommandResult parse_lua(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'lua' command - Implements Command::parse() -.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG2
Log at debug level 2.
bool lua_init_state(lua_State **l)
Initialise a Lua State.
const struct Command LuaCommands[]
List of NeoMutt commands to register.
Integrated Lua scripting.
@ MODULE_ID_LUA
ModuleLua, Integrated Lua scripting
Convenience wrapper for the library headers.
void expand_path(struct Buffer *buf, bool regex)
Create the canonical path.
Some miscellaneous functions.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
String manipulation buffer.
char * dptr
Current read/write position.
const char * name
Name of the Command.
lua_State * lua_state
Lua State.
Container for Accounts, Notifications.
Context for config parsing (history/backtrace)
Detailed error information from config parsing.
struct Buffer * message
Error message.