mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 06:18:16 +00:00
lua: introduce vim.loop (expose libuv event-loop) #10123
Co-authored-by: Andrey Popp <8mayday@gmail.com> closes #9546 closes #10084
This commit is contained in:

committed by
Justin M. Keyes

parent
3e58e60568
commit
c83926cd0a
@@ -31,6 +31,8 @@
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/lua/converter.h"
|
||||
|
||||
#include "luv/luv.h"
|
||||
|
||||
typedef struct {
|
||||
Error err;
|
||||
String lua_err_str;
|
||||
@@ -176,6 +178,11 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
lua_pushcfunction(lstate, &nlua_schedule);
|
||||
lua_setfield(lstate, -2, "schedule");
|
||||
|
||||
// vim.loop
|
||||
luv_set_loop(lstate, &main_loop.uv);
|
||||
luaopen_luv(lstate);
|
||||
lua_setfield(lstate, -2, "loop");
|
||||
|
||||
lua_setglobal(lstate, "vim");
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user