5 releases

new 0.2.1 Feb 4, 2023
0.2.0 Jan 28, 2023
0.1.3 Jan 25, 2023
0.1.2 Jan 25, 2023
0.1.0 May 10, 2021

#101 in Command-line interface

Download history 4/week @ 2022-11-10 1/week @ 2022-11-17 1/week @ 2022-12-01 2/week @ 2022-12-08 1/week @ 2022-12-22 1/week @ 2023-01-05 2/week @ 2023-01-12 34/week @ 2023-01-19 55/week @ 2023-01-26

92 downloads per month

MPL-2.0 license

2.5K SLoC

Lune 🌙

A standalone
Luau script runner
🚀 Use the ergonomics and readability of Luau for your shell scripts 🚀

⚙️ Installation

The preferred way of installing Lune is using Aftman.

This will add lune to an aftman.toml file in the current directory, or create one if it does not exist:

aftman add filiptibell/lune

You can also download pre-built binaries for most systems directly from the GitHub Releases page.

✏️ Writing Lune Scripts

Check out the examples on how to write a script in the .lune folder !
A great starting point and walkthrough of Lune can be found in the Hello, Lune example.

🔎 List of APIs

console - Logging & formatting
fs - Filesystem
net - Networking
process - Current process & child processes
task - Task scheduler & thread spawning

Documentation for individual members and types can be found using your editor of choice and Luau LSP.

🔀 Example translation from Bash
while [ $VALID ]
    echo $COUNT
    if [ $COUNT -eq 5 ];

With Lune & Luau:

local valid = true
local count = 1
while valid do
    if count == 5 then
    count += 1
🧑‍💻 Configuring VSCode for Lune

Lune puts developer experience first, and as such provides type definitions and configurations for several tools out of the box.

Luau LSP
  1. Set the require mode setting to relativeToFile
  2. Use lune --download-luau-types to download Luau types (luneTypes.d.luau) to the current directory
  3. Set your definition files setting to include luneTypes.d.luau
  4. Generate the documentation file using lune --generate-docs-file
    • NOTE: This is a temporary solution and a docs file separate from type definitions will not be necessary in the future
  5. Set your documentation files setting to include luneDocs.json

An example of these settings can be found in the .vscode folder in this repository

  1. Use lune --download-selene-types to download Selene types (lune.yml) to the current directory
  2. Use either std = "luau+lune", or std = "roblox+lune" if your project also contains Roblox-specific code, in your selene.toml configuration file

NOTE: It is highly recommended to add any type definition files to your .gitignore and to only download them using these commands, since this guarantees that you have type definitions compatible with your installed version of Lune.

🏃 Running Lune Scripts

After you've written a script file, for example script-name.luau, you can run it:

lune script-name

This will look for the file script-name.luau in a few locations:

  • The current directory
  • The folder lune in the current directory, if it exists
  • The folder .lune in the current directory, if it exists

If you don't want Lune to look in sub-directories you can provide a full file path with the file extension included, instead of only the file name.

💭 Additional Commands

lune --list

Lists all scripts found in lune or .lune directories, including any top-level description comments.
Lune description comments are always written at the top of a file and start with a lua-style comment arrow (-->).

NOTE: Lune also supports files with the .lua extension but using the .luau extension is highly recommended.


~405K SLoC