Compatibility
Minecraft: Java Edition
26.1.x
1.21.1
1.20.1
Platforms
Supported environments
Client-side
Server-side
Client and server
Tags
Creators
Details
![]()
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.
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.


