XiaoHook.cc Lua API

The XiaoHook.cc Lua API for Minecraft Bedrock. Draw on the screen, read the game state, react to events and work with network packets from a script.

The XiaoHook.cc Lua API lets you extend the client with your own scripts. A script is plain Lua text that you paste in the Lua tab and run with one button. It can draw an overlay, read the player and the world, listen to game events and read, edit, block or send network packets.

Write your first script xiaohook.cc Discord


What a script can do

Category What you get Where to read
Overlay Lines, circles, rectangles, polygons, text and images drawn over the game, in screen or world coordinates xiao.paint, Overlay guide
Game state The local player, the world, visible players and mobs, inventory, hotbar, armor, blocks xiao.game, Player and world guide
Events Signals for chat, entities, damage, world changes, frame ticks and unload xiao.signal, Events guide
Packets Read, decode, build, send, intercept and block Bedrock packets xiao.packet
Input Read and change the angles, movement and buttons of every tick, on the client or in the packet the server receives xiao.cmd
Settings Read and change every client setting by key, load and save configs xiao.config
Files Read and write files inside C:\xiaohook xiao.fs
Timers Run code later, at an interval, or as a sequence with wait xiao.timer
Data JSON text in and out, and tables that persist across runs xiao.json, xiao.workspace
Notifications Show a toast of the client menu xiao.notify
Standard Lua math, string, table, os, bit, coroutine, debug, jit and the base functions, sandboxed base, string, table

Quick start

Every custom API lives under the global xiao table: xiao.paint, xiao.game, xiao.signal, xiao.packet, xiao.config, xiao.fs, xiao.json, xiao.timer, xiao.workspace, xiao.notify. The standard Lua libraries keep their usual global names.

local paint = xiao.paint
local gold = paint.color.hex("#F0C250")
local black = paint.color.rgb(0, 0, 0)

paint.add("hello", function(width, height)
    local me = xiao.game.player()
    if me == nil then return end
    local line = ("hp %.0f  %s"):format(me.health or 0, me.dimension_name or "?")
    paint.text.left(paint.point.vector2(20, 20), line, gold, black)
end)

Open the Lua tab, paste the script and press Execute: your health and dimension are written in the top left corner of the screen once you are in a world. Clear VM removes it.


What's new 2026-11-05

  • New xiao.timer: after, every, cancel, and spawn with wait for sequential code, on the frame clock.

  • New xiao.json encodes and decodes JSON, and xiao.workspace keeps a table per name in C:\xiaohook\lua\workspace, saved on Clear VM.

  • New xiao.notify(title, text, kind) shows a toast of the client menu.

  • New xiao.cmd, the Bedrock CreateMove: change the angles, the movement and the input buttons of every tick, before the client simulates it (createmove) or in the packet the server receives (authinput).

  • New xiao.config reads and changes every client setting by key (misc.hit_sound.volume), and loads, saves and lists configs.

  • New Packet log: Copy as Lua now writes readable code with named variables and enums, and Copy as receiver copies a ready to use receiver.

  • New Packet fields: msg:fields() and xiao.packet.fields return a packet as a Lua table, and send_fields, encode and writer:fields write it back.

  • New xiao.packet.hook intercepts packets: cancel, replace or edit them while they pass, with a 2 ms budget and hook_stats().

  • New Send queue: guaranteed send order, pending() and capacity().

  • New Signals chat, entity_add, entity_remove, damage and world_change.

  • New xiao.game.player(), world(), hotbar(), inventory(), armor(), offhand(), held_item(), selected_slot(), block(x, y, z) and richer entities (type, is_player, distance).

  • New Copy and paste in the editor no longer block the game.

The full list is in the Changelog.


Where to go next

Engine

base, bit, coroutine, debug, fs, json, math, notify, os, paint, signal, string, table, timer, workspace.

Minecraft Bedrock

Guides

First script, Overlay, Events, Player and world, Reading packets, Sending packets, Modifying packets, Sandbox, Running scripts (including the execution contexts table), Changelog.


Game support

Game Version Status
Minecraft Bedrock (Windows) 1.26.6201.0 Supported