luadatapacktypes

Logo

Build Releases

LuaDatapack

Allows lua scripts to be ran in Minecraft

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

Usage

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

Features

  • Uses Cobalt under the hood, which gives fast execution times
  • Scripts can be included from datapacks using require and use Minecraft's namespaced id system
  • Supports a few common utility libraries

Commands

/lua

Usage: /lua <name> [<args>]

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

Arguments can be accessed via an array named args

Api

The api reference can be found here. Although it is for TypeScriptToLua, it can be adapted for lua

Standard library

A few utility libraries are included by default

Library Path
json.lua std:json
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

Note: If you prefer a different OOP library, you can simply add one to the datapack. If people do not like this one, it can be replaced in the future

Contributing

Any help is appreciated. Issues and feature requests can be shared here

Things to do

  • Optimize lua api
  • Use commands less (except say, as it is faster for some reason)

Planned features

Links

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

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

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

Generated using TypeDoc