aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/viml/executor/executor.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-29 02:41:37 +0300
committerZyX <kp-pav@yandex.ru>2017-03-27 00:12:23 +0300
commit872a909150506828f72a63636e1cfd6b72f1b306 (patch)
tree36f8399ec115692596630b1fdc24cd35ead88ae4 /src/nvim/viml/executor/executor.c
parent62fde319360e27a86c0deba0053ff230f80ca772 (diff)
downloadrneovim-872a909150506828f72a63636e1cfd6b72f1b306.tar.gz
rneovim-872a909150506828f72a63636e1cfd6b72f1b306.tar.bz2
rneovim-872a909150506828f72a63636e1cfd6b72f1b306.zip
executor: Add :lua command
Does not work currently.
Diffstat (limited to 'src/nvim/viml/executor/executor.c')
-rw-r--r--src/nvim/viml/executor/executor.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/viml/executor/executor.c b/src/nvim/viml/executor/executor.c
index acc375881c..8da218270a 100644
--- a/src/nvim/viml/executor/executor.c
+++ b/src/nvim/viml/executor/executor.c
@@ -7,8 +7,10 @@
#include "nvim/garray.h"
#include "nvim/func_attr.h"
#include "nvim/api/private/defs.h"
+#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/vim.h"
+#include "nvim/ex_getln.h"
#include "nvim/message.h"
#include "nvim/viml/executor/executor.h"
@@ -171,8 +173,6 @@ static lua_State *global_lstate = NULL;
/// Execute lua string
///
-/// Used for :lua.
-///
/// @param[in] str String to execute.
/// @param[out] ret_tv Location where result will be saved.
///
@@ -267,3 +267,18 @@ void executor_eval_lua(const String str, typval_T *const arg,
NLUA_CALL_C_FUNCTION_3(global_lstate, nlua_eval_lua_string, 0,
(void *)&str, arg, ret_tv);
}
+
+/// Run lua string
+///
+/// Used for :lua.
+///
+/// @param eap VimL command being run.
+void ex_lua(exarg_T *const eap)
+ FUNC_ATTR_NONNULL_ALL
+{
+ char *const code = (char *)script_get(eap, eap->arg);
+ typval_T tv = { .v_type = VAR_UNKNOWN };
+ executor_exec_lua(cstr_as_string(code), &tv);
+ clear_tv(&tv);
+ xfree(code);
+}