wiki/_next/data/Ie9t5zutrXP6Of75Cb5xF/lang.lua.modules.json
2022-07-29 15:41:17 +00:00

1 line
2.2 KiB
JSON

{"pageProps":{"metadata":{"date":"2022-04-20 18:36:59 +08:00","date_modified":"2022-04-20 18:37:17 +08:00","language":"en","source":""},"title":"Lua modules","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"for future references, this is documented from the "},{"type":"element","tagName":"a","properties":{"href":"https://www.lua.org/manual"},"children":[{"type":"text","value":"Lua manual"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"to use the modules from "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"lua"}]},{"type":"text","value":", you can call "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"require"}]},{"type":"text","value":" builtin;\n the "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"require"}]},{"type":"text","value":"'d module are stored in a table "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"packages.loaded"}]},{"type":"text","value":" and its content will be loaded inside of a function;\n the module will only load once and it will only cache the return value\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"to unload a module, you can set the package from the package table to null (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"nil"}]},{"type":"text","value":")\n"}]}]}]}]},"backlinks":[{"path":"/editor.neovim.lua-modules","title":"Neovim Lua modules"}]},"__N_SSG":true}