https://github.com/neoapps-dev/easylua
A Lua module to make Lua even easier!
https://github.com/neoapps-dev/easylua
Last synced: over 1 year ago
JSON representation
A Lua module to make Lua even easier!
- Host: GitHub
- URL: https://github.com/neoapps-dev/easylua
- Owner: neoapps-dev
- Created: 2025-01-24T17:53:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-24T18:34:41.000Z (over 1 year ago)
- Last Synced: 2025-01-24T19:30:35.786Z (over 1 year ago)
- Language: Lua
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
EasyLua
Minimal Lua module to not reinvent the wheel.
[](https://lua.org) [](https://app.codeac.io/github/neoapps-dev/easylua) [](https://github.com/neoapps-dev/buildit/blob/master/LICENSE)
**EasyLua** is a lightweight Lua utility library designed to simplify everyday programming tasks. It aims to eliminate the repetitive work of implementing common utility functions and provides developers with a collection of reusable, cross-platform tools. Whether you're working on a game, web app, or general scripting task, EasyLua can make your Lua development faster and more efficient.
---
## 📌 **Why EasyLua?**
Lua is a powerful and lightweight scripting language, but it lacks many built-in utility functions that developers often need. EasyLua fills this gap by offering a suite of features for:
- File Handling
- JSON Operations
- String Manipulations
- Table Management
- Mathematical Computations
- Date/Time Utilities
With EasyLua, you can save time and focus on building your application instead of writing utility functions from scratch.
---
## 🚀 **Core Features**
### 🔹 **File Utilities**
Simplify file operations with intuitive functions:
- **Read, write, and append** to files.
- **Rename and delete** files safely.
- **Check if files exist** or create directories.
### 🔹 **JSON Utilities**
Handle JSON data effortlessly:
- Encode tables to JSON strings.
- Decode JSON strings into Lua tables.
- Pretty-print JSON for debugging.
### 🔹 **Number Utilities**
Perform common number-related tasks:
- Generate random integers.
- Check if a number is even or odd.
- Calculate factorials or Fibonacci numbers.
### 🔹 **String Utilities**
Work smarter with strings:
- Trim whitespace.
- Split strings into tables by a delimiter.
- Convert to upper or lower case.
- Replace substrings easily.
### 🔹 **Table Utilities**
Take control of Lua tables:
- Deep copy or merge tables.
- Flatten nested tables.
- Sort tables by keys or values.
- Search for specific values.
### 🔹 **Math Utilities**
Boost your math operations:
- Clamp numbers within a range.
- Calculate the Greatest Common Divisor (GCD) or Least Common Multiple (LCM).
- Check if a number is prime.
### 🔹 **Date/Time Utilities**
Handle time-related operations effortlessly:
- Convert timestamps to human-readable formats.
- Get the current date and time in custom formats.
---
## 🛠️ **Getting Started**
Please note that we've only tested it on GNU/Linux (Arch btw) and Windows only. tests on other devices like macOS and BSD are welcome. please flag any issues you encounter.
### Installation
1. Install [BuildIt](https://github.com/neoapps-dev/buildit)
2. Package EasyLua as a one file:
```bash
buildit pack
```
3. Copy the generated `dist/easy.lua` file to your project directory.
### Usage
Load the module and start using its utilities:
```lua
local Easy = require("easy")
-- Example: Reading a file
local content = Easy.Lua.readFile("example.txt")
print(content)
-- Example: JSON Encoding
local jsonString = Easy.Lua.jsonEncode({ key = "value" })
print(jsonString)
```
---
## 🤝 **Contribution Guide**
Contributions are welcome! If you want to add a new feature or fix a bug, follow these steps:
1. Fork the repository.
2. Create a new branch (`feature/your-feature` or `bugfix/your-fix`).
3. Add your code and document it.
4. Submit a pull request with a clear description of your changes.
---
## 📄 **License**
EasyLua is licensed under the [MIT License](https://github.com/neoapps-dev/easylua/blob/main/LICENSE), allowing you to use it freely in both open-source and commercial projects.
---
Made with ❤️ by [NEOAPPS DEV](https://github.com/neoapps-dev) and the open-source community.