From ffaf74f1477d3182ffc70bcc9913effc44c90ea7 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 20 Apr 2023 14:41:47 +0200 Subject: fix(build): distinguish vim.mpack from global require'mpack' problem: the api of vim.mpack is not compatible with a system provided mpack solution: don't require 'mpack' directly from the system path --- src/nlua0.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/nlua0.c (limited to 'src/nlua0.c') diff --git a/src/nlua0.c b/src/nlua0.c new file mode 100644 index 0000000000..af811df324 --- /dev/null +++ b/src/nlua0.c @@ -0,0 +1,13 @@ +#include + +#include "mpack/lmpack.h" + +LUA_API int luaopen_nlua0(lua_State* L); + +LUA_API int luaopen_nlua0(lua_State* L) { + lua_getglobal(L, "vim"); + luaopen_mpack(L); + lua_setfield(L, -2, "mpack"); + + return 1; +} -- cgit From 45bcf8386918bbb475fbe20c48b508aa89ed0624 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 20 Apr 2023 13:19:38 +0200 Subject: refactor(build): include lpeg as a library --- src/nlua0.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nlua0.c') diff --git a/src/nlua0.c b/src/nlua0.c index af811df324..2cfa16b804 100644 --- a/src/nlua0.c +++ b/src/nlua0.c @@ -9,5 +9,10 @@ LUA_API int luaopen_nlua0(lua_State* L) { luaopen_mpack(L); lua_setfield(L, -2, "mpack"); + int luaopen_lpeg(lua_State *); + luaopen_lpeg(L); + lua_setfield(L, -3, "lpeg"); + lua_pop(L, 2); + return 1; } -- cgit