LuneScript - Making Lua Safer and More Comfortable
About the Source:
This reference is a reorganized version of the original LuneScript documentation (https://ifritjp.github.io/documents/en/lunescript/), created using AI.
Notice:
This document focuses on key features and may not cover everything. For full specifications, the entire
language scope, and the latest updates, please refer to the original documentation
mentioned above.
LuneScript is a transcompiler language that provides the robustness needed for large-scale development while
maintaining the flexibility and lightness of Lua.
It allows you to leverage the Lua ecosystem while using modern features like type safety, class-based OOP,
and generics.
Key Features
- Null Safety: Eliminates runtime errors caused by
nilreferences at compile time. - Static Typing: Combines the ease of writing dynamic languages with the safety of static languages through powerful type inference.
- Generics: Define reusable and type-safe components using type parameters.
- Class Support: Supports modern OOP features such as inheritance, interfaces, and abstract classes.
- Pattern Matching: Safely and concisely process Algebraic Data Types (ADT).
- Error Delegation: The
!operator allows for concise and safe error handling similar to Rust. (Details) - Uninitialized Variable Detection: Flow analysis prevents variables from being referenced while uninitialized.
- Zero Overhead: The generated Lua code is as natural as if written by a human, with no performance overhead.
- Go Transpilation: Supports transpilation not only to Lua but also to the Go language, providing a path to even higher performance.
- Macro System: Features a macro system to reduce redundant code.
- Mapping: Facilitates mutual conversion between data (such as JSON) and objects.
Try in Browser
You can try LuneScript directly in your browser (no installation required) at the following site:
Target Audience
This document is intended for software engineers with experience in some programming language (C, Java,
Python, TypeScript, etc.).
Knowledge of Lua is not required but helpful for understanding.
License
LuneScript is open-source software released under the MIT License.