MLua

Quick rating

Community listing page, reviews may not be monitored by the author.

MLua

By EncDataOwner

No reviews yet

Pure Java Lua-style scripting library mod for Minecraft.

Mod Loaders
Minecraft

About

Description

MLua

MLua lets you write Minecraft mod scripts in Lua. Scripts can interact with the game through APIs for players, worlds, events, commands, UI, and registered content.

Scripts

During development, place scripts in:

run/mlua/scripts/

Mods can bundle scripts in their JAR at:

assets/<modid>/mlua/scripts/

It will recognizes these script types:

*.mixin.lua      mixin scripts
*.registry.lua   registry scripts
*.commands.lua   command scripts
*.server.lua     server scripts
*.client.lua     client scripts
*.lua            module scripts

API reference

MLua would generate its documentation in the Minecraft client. Open run/mlua/docs/index.html after launching the game. It shows you the APIs available in that build.

Example

local Players = Minecraft:GetService("Players")
local World = Minecraft:GetService("World")

Players.PlayerAdded:Connect(function(player)
    player:SendMessage("Hello from MLua!")
    player:SetGameMode(GameMode.Creative)
end)

World:SetWeather(Weather.Clear)

Using MLua from another mod

Include MLua with your mod and declare it as a dependency.