#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
#include <tree_sitter/api.h>
#include "luv/luv.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/ascii.h"
#include "nvim/assert.h"
#include "nvim/buffer_defs.h"
#include "nvim/change.h"
#include "nvim/cursor.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/event/loop.h"
#include "nvim/event/time.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/extmark.h"
#include "nvim/func_attr.h"
#include "nvim/garray.h"
#include "nvim/getchar.h"
#include "nvim/lua/converter.h"
#include "nvim/lua/executor.h"
#include "nvim/lua/stdlib.h"
#include "nvim/lua/treesitter.h"
#include "nvim/macros.h"
#include "nvim/map.h"
#include "nvim/memline.h"
#include "nvim/message.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/os/os.h"
#include "nvim/screen.h"
#include "nvim/undo.h"
#include "nvim/version.h"
#include "nvim/vim.h"
Data Structures | |
struct | LuaError |
struct | ModuleDef |
Macros | |
#define | PUSH_ALL_TYPVALS(lstate, args, argcount, special) |
#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" |
Typedefs | |
typedef enum luv_err_type | luv_err_t |
Enumerations | |
enum | luv_err_type { kCallback, kThread, kThreadCallback } |
Variables | |
int | retval = nlua_luv_thread_cfpcall(lstate, 1, 0, flags) |
#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 | ) |
#define PUSH_ALL_TYPVALS | ( | lstate, | |
args, | |||
argcount, | |||
special | |||
) |
typedef enum luv_err_type luv_err_t |
enum luv_err_type |
Gets a new reference to an object stored at original_ref
NOTE: It does not copy the value, it creates a new ref to the lua object. Leaves the stack unchanged.
Run lua string
Used for :lua.
eap | VimL command being run. |
Run lua string for each line in range
Used for :luado.
eap | VimL command being run. |
Run lua file
Used for :luafile.
eap | VimL command being run. |
static int lua_pushlightuserdata | ( | lstate | , |
ud | |||
) |
int nlua_call | ( | lua_State * | lstate | ) |
call a LuaRef as a function (or table with __call metamethod)
ref | the reference to call (not consumed) |
name | if non-NULL, sent to callback as first arg if NULL, only args are used |
retval | if true, convert return value to Object if false, discard return value |
err | Error details, if any (if NULL, errors are echoed) |
Execute Lua string
Used for nvim_exec_lua() and internally to execute a lua string.
[in] | str | String to execute. |
[in] | args | array of ... args |
[out] | err | Location where error will be saved. |
bool nlua_exec_file | ( | const char * | path | ) |
execute lua code from a file.
Note: we call the lua global loadfile as opposed to calling luaL_loadfile in case loadfile has been overridden in the users environment.
path | path of the file |
void nlua_execute_on_key | ( | int | c | ) |
LuaRef nlua_get_empty_dict_ref | ( | lua_State * | lstate | ) |
int nlua_get_global_ref_count | ( | void | ) |
LuaRef nlua_get_nil_ref | ( | lua_State * | lstate | ) |
int nlua_in_fast_event | ( | 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.
LuaRef nlua_ref | ( | lua_State * | lstate, |
nlua_ref_state_t * | ref_state, | ||
int | index | ||
) |
add the value to the registry The current implementation does not support calls from threads.
LuaRef nlua_ref_global | ( | lua_State * | lstate, |
int | index | ||
) |
int nlua_source_using_linegetter | ( | LineGetter | fgetline, |
void * | cookie, | ||
char * | name | ||
) |
void nlua_typval_call | ( | const char * | str, |
size_t | len, | ||
typval_T *const | args, | ||
int | argcount, | ||
typval_T * | ret_tv | ||
) |
Evaluate lua string
Used for luaeval().
[in] | str | String to execute. |
[in] | arg | Second argument to luaeval() . |
[out] | ret_tv | Location where result will be saved. |
void nlua_unref | ( | lua_State * | lstate, |
nlua_ref_state_t * | ref_state, | ||
LuaRef | ref | ||
) |
remove the value from the registry
int tslua_get_language_version | ( | lua_State * | L | ) |
int tslua_get_minimum_language_version | ( | lua_State * | L | ) |
int typval_exec_lua_callable | ( | lua_State * | lstate, |
LuaCallable | lua_cb, | ||
int | argcount, | ||
typval_T * | argvars, | ||
typval_T * | rettv | ||
) |
Call a LuaCallable given some typvals
Used to call any lua callable passed from Lua into VimL
[in] | lstate | Lua State |
[in] | lua_cb | Lua Callable |
[in] | argcount | Count of typval arguments |
[in] | argvars | Typval Arguments |
[out] | rettv | The return value from the called function. |
return retval = nlua_luv_thread_cfpcall(lstate, 1, 0, flags) |