Lua Modules are an integral part of Liquipedia. They allow for more complex logic for rendering elements. The website supports adding and editing these modules straight from the browser. For more complex modules however, a more integrated developer environment has been requested by several users. To provide in this need this github repository has been constructed. Any modules added in this repository will, after a review process, be added to the modules and templates of the website.
Note: Modules in this repository are only a subset off those on the website. Any 'duplicates' on the website will be overwritten by those in this repository.
If you want to contribute you may do that in any way you wish. We use the following steps for onboarding new developers.
Clone the repository. This requires git to be installed on your system.
Recommended to use WSL. Then follow the Unix instructions.
TODO: Write
- Install Lua. We use version 5.1. There are some 5.2 features which are available, but nothing from 5.3 onwards. Using a newer version is not recommended or supported. The lua version is restricted as we use LuaJit. If you're curious.
Using brew will warn you that lua 5.1 has been deprecated and installing is disabled. Can be installed by editing the file with
brew edit [email protected]
. Remove the line that saysdisable! date: "2022-07-31", because: :unmaintained
Finally runHOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]
which will then install it anyway. - Install the package manager, LuaRocks
brew install luarocks
- The project contains two third party dependencies, busted and luacheck. Install both through luarocks
luarocks install --lua-version=5.1 busted
<- used as a testing frameworkluarocks install --lua-version=5.1 luacheck
<- for linting- Make sure the installed rocks are available in your Path variable. How to do this might depend on your choice of terminal.
- Test if everything works by running
busted
from the command line in your projects root folder. If the tests run and are all green you should be good to go.
- Install an ide/texteditor of choice. The repo contains some presets for Visual Studio Code.
We recommend VSCode. Highly recommend that you get the extension Lua. The repo is setup with presets for this.
Highly recommend that you get the extension SumnekoLua.
Modules start with a header like:
---
-- @Liquipedia
-- wiki=commons
-- page=Module:$NameOfModule
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
The header is important, it is used by our automation to place a module in the correct wiki (commons here, other values are dota2, deadlock, rainbowsix etc. See the Api Docs under Available Wikis for all wikis). The page is like the path. It determines where within the wiki the file is deployed/hosted. Other files refer to each other based on this path.
The project is divided into folders based on language. Even though the project is called Lua-Modules, a part of this repository is in different languages/techniques.
- In the javascript folder are scripts that run in the client. Our current setup does not fully support all available features in html. So for example a dropdown (select) element can't be rendered from our back end properly. We use javascript to add these kind of features. Essentially anything that makes an element interactable, buttons mostly, are constructed or configured from javascript.
- The modules written in lua are found in the
standard
orcomponents
folder.- Most(read:some) modules are covered by unit tests. Tests are placed in the spec folder.
- Styling is found in the stylesheets folder. For styling we use less. Check out their documentation for getting up to speed on how this differs from traditional css.
You need to be a member of the Liquipedia organization before you are allowed to push to this repository. In most workflows, you will make a fork of this repository to your own repository, and request a merge request from there. Trusted contributers may be given the privilege of directly branching within the repository. These privileges are always up to the discretion of Liquipedia staff.
If you encounter any issues or have questions, feel free to open an issue on GitHub or reach out to the Liquipedia community for support.
We would like to thank all the contributors who have helped in developing and maintaining this repository. Your efforts are greatly appreciated.
Most of this repository follows the license of the textual content of Liquipedia, check out the license file for more information, unless otherwise stated in a README.md for a directory, or in the header of a file.