Added usage and examples.
This commit is contained in:
parent
3d07c81cef
commit
c950fd6c00
|
@ -1,18 +1,16 @@
|
|||
|
||||
-- ||| Suggest-Require ||| -----------------------------------------------------
|
||||
|
||||
-- Version 1, minor 2 ( 9. January 2018 )
|
||||
|
||||
-- This is a small library to discover which modules are importable using
|
||||
-- `require`. It's useful for seeing which modules your Lua environment
|
||||
-- can access. It's intended usage is in an auto-complete system for Lua.
|
||||
|
||||
-- Known to work with Lua 5.1 and LuaJIT, on Linux.
|
||||
|
||||
-- Author: Jmaa
|
||||
-- Email: jonjmaa@gmail.com
|
||||
-- Website: aanes.xyz
|
||||
|
||||
-- Initially created in September 2017.
|
||||
|
||||
-- "THE BEER-WARE LICENSE" (Revision 42):
|
||||
-- <jonjmaa@gmail.com> wrote this file. As long as you retain this notice you
|
||||
-- can do whatever you want with this stuff. If we meet some day, and you think
|
||||
|
@ -20,6 +18,32 @@
|
|||
|
||||
-- TODO: Ensure it works under both Windows and MacOS.
|
||||
|
||||
--[[ Usage ]]--
|
||||
|
||||
-- Standalone: The library be called as a script `luajit
|
||||
-- suggest-require.lua` to print available packages in the Lua
|
||||
-- environment.
|
||||
|
||||
-- Library: Import through require. A single function is be returned.
|
||||
-- Calling this function will return the available packages, as a list
|
||||
-- of strings.
|
||||
|
||||
--[[ Example ]]--
|
||||
|
||||
-- Replicating the script functionality of this library is as simple as:
|
||||
|
||||
-- local package_names = require 'suggest-require' ()
|
||||
-- for _, name in ipairs(package_names) do
|
||||
-- print('- '..name)
|
||||
-- end
|
||||
|
||||
--[[ Changelog ]]--
|
||||
|
||||
-- 1.3: Usage and example (6. July 2020)
|
||||
-- 1.2: Unknown change (9. January 2018)
|
||||
-- 1.1: Unknown change (Unknown)
|
||||
-- 1.0: Initial version (September 2017)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Platform dependant
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user