lua/executor: Move stricmp to vim “module” and document it

This commit is contained in:
ZyX
2017-08-15 16:32:06 +03:00
parent 96b1600bc8
commit 93ef823f5e
3 changed files with 78 additions and 73 deletions

View File

@@ -281,10 +281,6 @@ static int nlua_exec_lua_file(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
/// Called by lua interpreter itself to initialize state.
static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
{
// stricmp
lua_pushcfunction(lstate, &nlua_stricmp);
lua_setglobal(lstate, "stricmp");
// print
lua_pushcfunction(lstate, &nlua_print);
lua_setglobal(lstate, "print");
@@ -304,6 +300,10 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
nlua_add_api_functions(lstate);
// vim.types, vim.type_idx, vim.val_idx
nlua_init_types(lstate);
// stricmp
lua_pushcfunction(lstate, &nlua_stricmp);
lua_setfield(lstate, -2, "stricmp");
lua_setglobal(lstate, "vim");
return 0;
}