mgba_run_lua
Execute custom Lua scripts in the mGBA emulator to automate testing, analyze game data, read/write memory, capture screenshots, and generate structured output for Game Boy, GBC, and GBA ROMs.
Instructions
Run a custom Lua script in the emulator. The script can use emu:read8(), emu:write8(), emu:screenshot(), callbacks:add(), etc.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"rom_path": "<rom_path>",
"script": "<script>"
},
"name": "mgba_run_lua"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rom_path | Yes | Path to the ROM file | |
| script | Yes | Lua script to execute. Use emu:quit() to exit. Write JSON to 'output.json' for structured data. | |
| savestate_path | No | Optional savestate to load | |
| timeout | No | Timeout in seconds (default: 30) |