LuaDatapack

⭐ — (19 endorsements) 📥 1,491 downloads 📌 v0.11.0-beta 📅 7/9/2022
⚪ Last updated 2023

By kinderhead · fabric

⬇ Download Mod Source: Modrinth ↗ 📅 Updated: 6/15/2023 📅 Created: 7/9/2022
⚠️ Install Order · 2 steps
1🛠️ Forge — Minecraft Forge (mod loader) Download ↗
2🛠️ Fabric — Fabric Loader Download ↗

Install in this order, then this mod last — most mods fail to load without their framework and dependencies in place.

🔍 Analysis

  • 👍 1.3% endorsement rate — high engagement, a strong quality signal
  • 🏆 #251 of 892 fabric mods in this game by downloads

📋 About This Mod

!(https://raw.githubusercontent.com/kinderhead/LuaDatapack/master/logo.png)

[!(https://img.shields.io/github/v/release/kinderhead/LuaDatapack?include_prereleases&sort=semver)](https://github.com/kinderhead/LuaDatapack/releases) [!(https://img.shields.io/modrinth/dt/bgUHPLzW)](https://modrinth.com/mod/luadatapack)

# LuaDatapack

Allows lua scripts to be ran in Minecraft.

Note: LuaDatapack is in beta, so the api is subject to change.

I currently don't plan on working on this project much more. Instead I've been making a dedicated programming language that compiles to Minecraft commands called (https://github.com/kinderhead/Amethyst/). It's more useful than this because it doesn't require a dedicated mod.

Create a new datapack with the `lua` subfolder. For example: `data/foo/lua/bar.lua`.

## Features

Uses (https://github.com/SquidDev/Cobalt) under the hood, which gives fast execution times Scripts can be included from datapacks using `require` and use Minecraft's namespaced id system (https://typescripttolua.github.io/) support Supports a few common utility libraries (https://github.com/rxi/json.lua) (https://github.com/jonstoler/class.lua)

## Commands

Usage: `/lua []`

Example, to run `data/foo/lua/bar.lua`: `/lua foo:bar`

Arguments can be accessed via an array called `args` in the lua script.

The api reference can be found (https://kinderhead.github.io/LuaDatapack/).

## Standard library

A few utility libraries are included by default.

|Library|Path| |---|---| |(https://github.com/rxi/json.lua)|`std:json`| |(https://github.com/jonstoler/class.lua)|`std:class`| |Standard lua library|`std:math`| |Standard lua library|`std:string`| |Standard lua library|`std:bit32`| |Standard lua library|`std:utf8`| |Commands library|`std:commands`| |Storage library|`std:storage`| |Configuration utilities library|`std:config`|

Note: If you prefer a different OOP library, you can simply add one to your datapack.

## Project system

There is a simple project system which allows for customization of which scripts can be executed and imported by external projects (scripts not in the same namespace).

To customize your project, add a `_project.lua` file to your namespace. For example if the namespace was `foo` then you would make a `foo:_project.lua`:

``` lua return { scripts = {"foo:bar"}, exports = {"foo:baz"}, depends = {"hello"},

load = {"foo:load"}, tick = {"foo:tick"} } ```

In the above example `foo:bar` is a script to be ran via `/lua`, `foo:baz` is a script that any file can `require`, and it requires the `hello` project to function. Scripts can import any script in the same namespace, even if it is not included in the `exports` array. If a project does not include a `_project.lua`, then the default `std:_default_datapack` is used instead: ``` lua local config = require("std:config")

return { scripts = config.without_underscore(), exports = {} } ```

Note: not all fields need to be explicitly defined.

If a project fails to load, all scripts in it are unable to load.

## Contributing

Building this repo is the same as any other Fabric mod. There may be issues with libraries (Cobalt, Apache commons-io, etc) not loading when starting the game, but running the game though the VSCode debugger works for some reason.

### Things to do

Optimize lua api Add more api features Use commands less internally

## Planned features

More commands * Development tools with (https://typescripttolua.github.io/)

Source: https://github.com/kinderhead/LuaDatapack

Modrinth: https://modrinth.com/mod/luadatapack

Api reference: https://kinderhead.github.io/LuaDatapack

🤖 AI-enhanced — based on mod data

📊 Mod Details

Game
Minecraft Mods
Author
kinderhead
Version
0.11.0-beta
Downloads
1,491
Endorsements
19
Category
fabric
Created
7/9/2022
Updated
6/15/2023
Game Versions
1.20, 1.20.1
Tags
library, utility

🔧 How to Install Minecraft Mods Mods

Download from Modrinth. Use Prism Launcher or drop into your mods folder.

📖 Full step-by-step install guide for Minecraft Mods →

Visit the official mod page for specific installation instructions for this mod.

🎮 Need cheat codes or console commands? Check ur gaming wiki for Minecraft Mods commands, item IDs, and more.

❓ Frequently Asked Questions

Which Minecraft Mods versions does LuaDatapack support?

The author lists 1.20, 1.20.1. Other versions may work but are untested by the author.

What is the latest version of LuaDatapack?

Version 0.11.0-beta, published 2023-06-15 with 1,491 downloads recorded at the source.

Keep browsing — more Minecraft Mods mods await

📋 All Minecraft Mods Mods 🏆 Top 25 📂 More fabric 👤 More by kinderhead 🔎 Similar Mods 🌐 Best fabric (All Games) 🔀 Check Compatibility ⚖️ Compare Mods 🆕 New Mods