NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Lua Module. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "core/lib.h"
#include "module_data.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool lua_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool lua_commands_register (struct NeoMutt *n, struct CommandArray *ca)
 Register NeoMutt Commands - Implements Module::commands_register()
 
static bool lua_cleanup (struct NeoMutt *n)
 Clean up a Module - Implements Module::cleanup()
 

Variables

const struct Command LuaCommands []
 List of NeoMutt commands to register.
 
const struct Module ModuleLua
 Module for the Lua library.
 

Detailed Description

Definition of the Lua Module.

Authors
  • Richard Russon

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 module.c.

Function Documentation

◆ lua_init()

static bool lua_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 41 of file module.c.

42{
43 // struct LuaModuleData *md = MUTT_MEM_CALLOC(1, struct LuaModuleData);
44 // neomutt_set_module_data(n, MODULE_ID_LUA, md);
45
46 return true;
47}

◆ lua_commands_register()

static bool lua_commands_register ( struct NeoMutt * n,
struct CommandArray * ca )
static

Register NeoMutt Commands - Implements Module::commands_register()

Definition at line 52 of file module.c.

53{
55}
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
const struct Command LuaCommands[]
List of NeoMutt commands to register.
Definition commands.c:146
+ Here is the call graph for this function:

◆ lua_cleanup()

static bool lua_cleanup ( struct NeoMutt * n)
static

Clean up a Module - Implements Module::cleanup()

Definition at line 60 of file module.c.

61{
62 // struct LuaModuleData *md = neomutt_get_module_data(n, MODULE_ID_LUA);
63 // ASSERT(md);
64
65 // FREE(&md);
66 return true;
67}

Variable Documentation

◆ LuaCommands

const struct Command LuaCommands[]
extern

List of NeoMutt commands to register.

Definition at line 146 of file commands.c.

146 {
147 // clang-format off
148 { "lua", CMD_LUA, parse_lua,
149 N_("Run a Lua expression or call a Lua function"),
150 N_("lua <lua-command>"),
151 "optionalfeatures.html#lua" },
152 { "lua-source", CMD_LUA_SOURCE, parse_lua_source,
153 N_("Execute a Lua script file"),
154 N_("lua-source <filename>"),
155 "optionalfeatures.html#lua" },
156
157 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NO_FLAGS },
158 // clang-format on
159};
#define CF_NO_FLAGS
No flags are set.
Definition command.h:48
@ CMD_LUA_SOURCE
:lua-source
Definition command.h:89
@ CMD_LUA
:lua
Definition command.h:88
@ CMD_NONE
No Command.
Definition command.h:59
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() -.
Definition commands.c:97
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() -.
Definition commands.c:57
#define N_(a)
Definition message.h:32

◆ ModuleLua

const struct Module ModuleLua
Initial value:
= {
"lua",
NULL,
NULL,
NULL,
NULL,
}
void lua_cleanup(void)
Clean up Lua.
Definition commands.c:164
static bool lua_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:41
static bool lua_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:52
@ MODULE_ID_LUA
ModuleLua, Integrated Lua scripting
Definition module_api.h:74

Module for the Lua library.

Definition at line 72 of file module.c.

72 {
74 "lua",
76 NULL, // config_define_types
77 NULL, // config_define_variables
79 NULL, // gui_init
80 NULL, // gui_cleanup
82};