Integrated Lua scripting. More...
#include "config.h"
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "mutt_lua.h"
#include "parse/lib.h"
#include "muttlib.h"
Go to the source code of this file.
Macros | |
#define | LUA_COMPAT_ALL |
#define | LUA_COMPAT_5_1 |
Functions | |
static int | handle_panic (lua_State *l) |
Handle a panic in the Lua interpreter. | |
static int | handle_error (lua_State *l) |
Handle an error in the Lua interpreter. | |
static int | lua_mutt_call (lua_State *l) |
Call a NeoMutt command by name. | |
static int | lua_mutt_set (lua_State *l) |
Set a NeoMutt variable. | |
static int | lua_mutt_get (lua_State *l) |
Get a NeoMutt variable. | |
static int | lua_mutt_enter (lua_State *l) |
Execute NeoMutt config from Lua. | |
static int | lua_mutt_message (lua_State *l) |
Display a message in Neomutt. | |
static int | lua_mutt_error (lua_State *l) |
Display an error in Neomutt. | |
static void | lua_expose_command (lua_State *l, const struct Command *cmd) |
Expose a NeoMutt command to the Lua interpreter. | |
static int | luaopen_mutt_decl (lua_State *l) |
Declare some NeoMutt types to the Lua interpreter. | |
static void | luaopen_mutt (lua_State *l) |
Expose a 'Mutt' object to the Lua interpreter. | |
static bool | lua_init (lua_State **l) |
Initialise a Lua State. | |
void | mutt_lua_init (void) |
Setup feature commands. | |
enum CommandResult | mutt_lua_parse (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err) |
Parse the 'lua' command - Implements Command::parse() -. | |
enum CommandResult | mutt_lua_source_file (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err) |
Parse the 'lua-source' command - Implements Command::parse() -. | |
Variables | |
static lua_State * | LuaState = NULL |
Global Lua State. | |
static const struct Command | LuaCommands [] |
List of NeoMutt commands to register. | |
static const luaL_Reg | LuaMuttCommands [] |
List of Lua commands to register. | |
Integrated Lua scripting.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file mutt_lua.c.
#define LUA_COMPAT_ALL |
Definition at line 35 of file mutt_lua.c.
#define LUA_COMPAT_5_1 |
Definition at line 38 of file mutt_lua.c.
|
static |
Handle a panic in the Lua interpreter.
l | Lua State |
-1 | Always |
Definition at line 73 of file mutt_lua.c.
|
static |
Handle an error in the Lua interpreter.
l | Lua State |
-1 | Always |
Definition at line 86 of file mutt_lua.c.
|
static |
Call a NeoMutt command by name.
l | Lua State |
>=0 | Success |
-1 | Error |
Definition at line 100 of file mutt_lua.c.
|
static |
Set a NeoMutt variable.
l | Lua State |
0 | Success |
-1 | Error |
Definition at line 153 of file mutt_lua.c.
|
static |
Get a NeoMutt variable.
l | Lua State |
1 | Success |
-1 | Error |
Definition at line 241 of file mutt_lua.c.
|
static |
Execute NeoMutt config from Lua.
l | Lua State |
>=0 | Success |
-1 | Error |
Definition at line 303 of file mutt_lua.c.
|
static |
Display a message in Neomutt.
l | Lua State |
0 | Always |
Definition at line 334 of file mutt_lua.c.
|
static |
Display an error in Neomutt.
l | Lua State |
0 | Always |
Definition at line 348 of file mutt_lua.c.
|
static |
Expose a NeoMutt command to the Lua interpreter.
Definition at line 362 of file mutt_lua.c.
|
static |
Declare some NeoMutt types to the Lua interpreter.
l | Lua State |
1 | Always |
Definition at line 397 of file mutt_lua.c.
|
static |
Expose a 'Mutt' object to the Lua interpreter.
l | Lua State |
Definition at line 418 of file mutt_lua.c.
|
static |
Initialise a Lua State.
[out] | l | Lua State |
true | Successful |
Definition at line 435 of file mutt_lua.c.
void mutt_lua_init | ( | void | ) |
Setup feature commands.
Definition at line 463 of file mutt_lua.c.
|
static |
Global Lua State.
Definition at line 56 of file mutt_lua.c.
|
static |
List of NeoMutt commands to register.
Definition at line 61 of file mutt_lua.c.
|
static |
List of Lua commands to register.
In NeoMutt, run:
‘:lua mutt.message('hello’)`
and it will call lua_mutt_message()
Definition at line 379 of file mutt_lua.c.