Lua Provider
Warning
This is a beta software. The API is not stable and may change at any time.
This is a generic provider for
libmangal that uses
Lua scripts to create subproviders.
It uses
native go implementation of the Lua interpreter
and provides a set of libraries that can be used in the scripts.
Take a look at
the official lua scripts repository
Features
- Built-in Lua VM without CGO with
gopher-lua
- Batteries-included library
- Ships with CLI helper tools for generating templates & probing.
- Luadoc generation which enables autocompletion for you IDE
- Script template generation
Note
It is recommended to use
lua-language-server to get
nice completions for your IDE
VSCode extension
Scripts
Overview
See examples of scripts
See SDK documentation
Scripts must look like this:
function SearchMangas(query)
return {}
end
function MangaVolumes(manga)
return {}
end
function VolumeChapters(volume)
return {}
end
function ChapterPages(chapter)
return {}
end
Notice the four required global functions
SearchMangas - searches for mangas based on the given query.
MangaVolumes - gets manga volumes. Each manga must have at least 1 volume.
VolumeChapters - gets chapters of the given volume.
ChapterPages - gets pages of the given chapter.
The scripts can load sdk with
local sdk = require("sdk")
Which provides these packages:
Documentation
Packages
Script Development
Install helper tools
just install-cmd
Then use it to generate a new workflow
lua-provider-gen -sdk -provider -luarc
This command will create the following files:
sdk.lua - gives IDE autocompletion
provider.lua - a provider script template
.luarc.json - a language server configuration