mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
lua: add vim.in_fast_event() to check if we are in a luv callback
This commit is contained in:
@@ -223,6 +223,9 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
// schedule
|
||||
lua_pushcfunction(lstate, &nlua_schedule);
|
||||
lua_setfield(lstate, -2, "schedule");
|
||||
// in_fast_event
|
||||
lua_pushcfunction(lstate, &nlua_in_fast_event);
|
||||
lua_setfield(lstate, -2, "in_fast_event");
|
||||
|
||||
// vim.loop
|
||||
luv_set_loop(lstate, &main_loop.uv);
|
||||
@@ -457,6 +460,12 @@ int nlua_debug(lua_State *lstate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nlua_in_fast_event(lua_State *lstate)
|
||||
{
|
||||
lua_pushboolean(lstate, in_fast_callback > 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/// os.getenv: override os.getenv to maintain coherency. #9681
|
||||
///
|
||||
|
Reference in New Issue
Block a user