aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 0a3c30134b..97f6d5bd31 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1244,6 +1244,23 @@ void ex_luafile(exarg_T *const eap)
}
}
+bool load_init_lua(const char *script_path)
+{
+ lua_State *const lstate = nlua_enter();
+
+ if (luaL_loadfile(lstate, script_path)) {
+ nlua_error(lstate, _("E5112: Error while creating lua chunk: %.*s"));
+ return false;
+ }
+
+ if (lua_pcall(lstate, 0, 0, 0)) {
+ nlua_error(lstate, _("E5113: Error while calling lua chunk: %.*s"));
+ return false;
+ }
+
+ return true;
+}
+
static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
{
tslua_init(lstate);