Skip to content

luevano/luaprovider

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a logo depicting a moon

Lua Provider

Go Reference

Warning

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.

Note: This is a fork of mangalorg/luaprovider.

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 (still in the original repo).

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 (still in the original repo).

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

Credits

Moon logo: Moon phase icons created by vectorsmarket15 - Flaticon

About

🌙 Generic provider for libmangal based on Lua scripts.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.1%
  • Other 0.9%