aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
commitc324271b99eee4c621463f368914d57cd729bd9c (patch)
tree5d979d333a2d5f9c080991d5482fd5916f8579c6 /src/nvim/lua/executor.h
parent931bffbda3668ddc609fc1da8f9eb576b170aa52 (diff)
parentade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff)
downloadrneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.gz
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.bz2
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.zip
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'src/nvim/lua/executor.h')
-rw-r--r--src/nvim/lua/executor.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/nvim/lua/executor.h b/src/nvim/lua/executor.h
index b38faddbb3..ebcd62122f 100644
--- a/src/nvim/lua/executor.h
+++ b/src/nvim/lua/executor.h
@@ -4,18 +4,13 @@
#include <lua.h>
#include <stdbool.h>
-#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
-#include "nvim/assert_defs.h"
-#include "nvim/cmdexpand_defs.h"
-#include "nvim/eval/typval_defs.h"
-#include "nvim/ex_cmds_defs.h"
+#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/func_attr.h"
-#include "nvim/lua/converter.h"
#include "nvim/macros_defs.h"
-#include "nvim/map_defs.h"
#include "nvim/types_defs.h"
-#include "nvim/usercmd.h"
+#include "nvim/usercmd.h" // IWYU pragma: keep
// Generated by msgpack-gen.lua
void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL;
@@ -29,7 +24,8 @@ typedef struct {
#endif
} nlua_ref_state_t;
-#define NLUA_EXEC_STATIC(cstr, arg, err) nlua_exec(STATIC_CSTR_AS_STRING(cstr), arg, err)
+#define NLUA_EXEC_STATIC(cstr, arg, mode, arena, err) \
+ nlua_exec(STATIC_CSTR_AS_STRING(cstr), arg, mode, arena, err)
#define NLUA_CLEAR_REF(x) \
do { \
@@ -40,6 +36,16 @@ typedef struct {
} \
} while (0)
+typedef enum {
+ kRetObject, ///< any object, but doesn't preserve nested luarefs
+ kRetNilBool, ///< NIL preserved as such, other values return their booleanness
+ ///< Should also be used when return value is ignored, as it is allocation-free
+ kRetLuaref, ///< return value becomes a single Luaref, regardless of type (except NIL)
+} LuaRetMode;
+
+/// To use with kRetNilBool for quick thuthyness check
+#define LUARET_TRUTHY(res) ((res).type == kObjectTypeBoolean && (res).data.boolean == true)
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/executor.h.generated.h"
#endif