mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 14:28:18 +00:00
Lua: vim.env, vim.{g,v,w,bo,wo} #11442
- Add vim variable meta accessors: vim.env, vim.{g,v,w,bo,wo} - Redo gen_char_blob to generate multiple blobs instead of just one so that multiple Lua modules can be inlined. - Reorder vim.lua inclusion so that it can use previously defined C functions and utility functions like vim.shared and vim.inspect things. - Inline shared.lua into nvim, but also keep it available in runtime.
This commit is contained in:

committed by
Justin M. Keyes

parent
222637c341
commit
d0d38fc36e
@@ -268,12 +268,7 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
#endif
|
||||
|
||||
// vim
|
||||
const char *code = (char *)&vim_module[0];
|
||||
if (luaL_loadbuffer(lstate, code, strlen(code), "@vim.lua")
|
||||
|| lua_pcall(lstate, 0, LUA_MULTRET, 0)) {
|
||||
nlua_error(lstate, _("E5106: Error while creating vim module: %.*s"));
|
||||
return 1;
|
||||
}
|
||||
lua_newtable(lstate);
|
||||
// vim.api
|
||||
nlua_add_api_functions(lstate);
|
||||
// vim.types, vim.type_idx, vim.val_idx
|
||||
@@ -334,6 +329,24 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
|
||||
lua_setglobal(lstate, "vim");
|
||||
|
||||
{
|
||||
const char *code = (char *)&shared_module[0];
|
||||
if (luaL_loadbuffer(lstate, code, strlen(code), "@shared.lua")
|
||||
|| lua_pcall(lstate, 0, 0, 0)) {
|
||||
nlua_error(lstate, _("E5106: Error while creating shared module: %.*s"));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const char *code = (char *)&vim_module[0];
|
||||
if (luaL_loadbuffer(lstate, code, strlen(code), "@vim.lua")
|
||||
|| lua_pcall(lstate, 0, 0, 0)) {
|
||||
nlua_error(lstate, _("E5106: Error while creating vim module: %.*s"));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user