#shell #lua #scripting-language #parser #lotus

bin+lib lotus-lua

Lua dialect for shell scripting with the Lotus shell

23 releases (8 breaking)

0.10.16 Feb 9, 2024
0.10.2 Jan 31, 2024
0.8.0 Dec 20, 2023

#228 in Programming languages

Download history 19/week @ 2023-12-18 3/week @ 2024-01-22 29/week @ 2024-01-29 18/week @ 2024-02-05 8/week @ 2024-02-19 29/week @ 2024-02-26 140/week @ 2024-04-01

140 downloads per month

MIT license

70KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments Lua 164 SLoC Pest 86 SLoC // 0.1% comments

Lotus Lua

A dialect of Lua written specifically for the Lotus shell; Lotus lua aims to be as close to vanilla Lua as possible while adding various improvements for shell scripting with Lua.

What about Luau?

Luau is another dialect of Lua, similar to Lotus. A common question is "why make Lotus if Luau exists?". While Luau has several nice features and several overlaps with Lotus, there are some features of Lotus such as the pipe operator and dollar signs in identifiers that we determined essential for the language to be effective for shell scripting.

Features & Roadmap

Lotus plans to add the following extensions to Lua:

  • Allow dollar signs in identifiers
  • Pipe operator (|>)
  • Template string literals
  • Compound assignments
  • Ternary ifs
  • Iterable tables
  • Optional type annotations
  • Increment and decrement operators

Feature Requests

If you would like to request a new feature/syntax for Lotus, please keep the following points in mind:

  • Lotus is meant to be a superset of Lua. In other words, all valid Lua must be valid lotus. We would like existing Lua scripts to be easily run in the Lotus shell. Please do not request new syntax that will break existing Lua code.
  • Lotus is meant to be simple. One of the major reasons Lua was chosen for this project is because it is a dead simple language. Please do not request new syntax that will make the language significantly more complex for little benefit.
  • Lotus is meant for shell scripting. Features that are related to shell scripting and making shell scripting easier are much more likely to be seriously considered than one-off niceties. If it is a new feature unrelated to shell scripting, such as iterable tables or ternary ifs, it should be a very common use-case and not a niche feature that will rarely be useful.

Dependencies

~9MB
~165K SLoC