Data Structures | Macros | Functions
executor.c File Reference
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include "nvim/misc1.h"
#include "nvim/getchar.h"
#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/msgpack_rpc/channel.h"
#include "nvim/vim.h"
#include "nvim/ex_getln.h"
#include "nvim/ex_cmds2.h"
#include "nvim/message.h"
#include "nvim/memline.h"
#include "nvim/buffer_defs.h"
#include "nvim/macros.h"
#include "nvim/screen.h"
#include "nvim/cursor.h"
#include "nvim/undo.h"
#include "nvim/ascii.h"
#include "nvim/change.h"
#include "nvim/lua/executor.h"
#include "nvim/lua/converter.h"
#include "nvim/lua/treesitter.h"
#include "luv/luv.h"

Data Structures

struct  LuaError


#define PRINT_ERROR(msg)
#define EVALHEADER   "local _A=select(1,...) return ("
#define CALLHEADER   "return "
#define CALLSUFFIX   "(...)"
#define DOSTART   "return function(line, linenr) "
#define DOEND   " end"


int nlua_debug (lua_State *lstate) FUNC_ATTR_NONNULL_ALL
int nlua_in_fast_event (lua_State *lstate)
int nlua_call (lua_State *lstate)
LuaRef nlua_ref (lua_State *lstate, int index)
 add the value to the registry More...
void nlua_unref (lua_State *lstate, LuaRef ref)
 remove the value from the registry More...
void executor_free_luaref (LuaRef ref)
void nlua_pushref (lua_State *lstate, LuaRef ref)
 push a value referenced in the regirstry More...
void executor_eval_lua (const String str, typval_T *const arg, typval_T *const ret_tv) FUNC_ATTR_NONNULL_ALL
void executor_call_lua (const char *str, size_t len, typval_T *const args, int argcount, typval_T *ret_tv) FUNC_ATTR_NONNULL_ALL
Object executor_exec_lua_api (const String str, const Array args, Error *err)
Object executor_exec_lua_cb (LuaRef ref, const char *name, Array args, bool retval, Error *err)
bool nlua_is_deferred_safe (lua_State *lstate)
void ex_lua (exarg_T *const eap) FUNC_ATTR_NONNULL_ALL
void ex_luado (exarg_T *const eap) FUNC_ATTR_NONNULL_ALL
void ex_luafile (exarg_T *const eap) FUNC_ATTR_NONNULL_ALL

Macro Definition Documentation

#define CALLHEADER   "return "
#define CALLSUFFIX   "(...)"
#define DOEND   " end"
#define DOSTART   "return function(line, linenr) "
#define EVALHEADER   "local _A=select(1,...) return ("
#define PRINT_ERROR (   msg)
do { \
errmsg = msg; \
errmsg_len = sizeof(msg) - 1; \
goto nlua_print_error; \
} while (0)
err msg
Definition: helpers.c:1469

Function Documentation

void ex_lua ( exarg_T *const  eap)

Run lua string

Used for :lua.

eapVimL command being run.
void ex_luado ( exarg_T *const  eap)

Run lua string for each line in range

Used for :luado.

eapVimL command being run.
void ex_luafile ( exarg_T *const  eap)

Run lua file

Used for :luafile.

eapVimL command being run.
void executor_call_lua ( const char *  str,
size_t  len,
typval_T *const  args,
int  argcount,
typval_T ret_tv 
void executor_eval_lua ( const String  str,
typval_T *const  arg,
typval_T *const  ret_tv 

Evaluate lua string

Used for luaeval().

[in]strString to execute.
[in]argSecond argument to luaeval().
[out]ret_tvLocation where result will be saved.
Result of the execution.
Object executor_exec_lua_api ( const String  str,
const Array  args,
Error err 

Execute Lua string

Used for nvim_exec_lua().

[in]strString to execute.
[in]argsarray of ... args
[out]errLocation where error will be saved.
Return value of the execution.
Object executor_exec_lua_cb ( LuaRef  ref,
const char *  name,
Array  args,
bool  retval,
Error err 
void executor_free_luaref ( LuaRef  ref)
int nlua_call ( lua_State *  lstate)
int nlua_debug ( lua_State *  lstate)

debug.debug: interaction with user while debugging.

lstateLua interpreter state.
int nlua_in_fast_event ( lua_State *  lstate)
bool nlua_is_deferred_safe ( lua_State *  lstate)

check if the current execution context is safe for calling deferred API methods. Luv callbacks are unsafe as they are called inside the uv loop.

void nlua_pushref ( lua_State *  lstate,
LuaRef  ref 

push a value referenced in the regirstry

LuaRef nlua_ref ( lua_State *  lstate,
int  index 

add the value to the registry

void nlua_unref ( lua_State *  lstate,
LuaRef  ref 

remove the value from the registry