Run Lua in the live game
dos2_live_luaRuns arbitrary Lua code on a running Divinity: Original Sin 2 server via Script Extender, returning JSON-serializable results for custom GM tasks beyond dedicated live tools.
Instructions
Runs arbitrary Lua on the game server through Script Extender, in the bridge mod's context, and returns the value of its return statement. The Ext and Osi APIs are available. This is the escape hatch for anything the other live tools do not cover: items, statuses, combat, level changes.
It can change or break anything in the running session, so prefer the dedicated tools (dos2_live_characters,
dos2_live_spawn, dos2_live_move, dos2_live_set, dos2_live_stage) when they fit. The returned value must be
JSON-serializable. Lua errors come back as an error with the message; a call that outlives timeout fails. Needs
the bridge (see dos2_live_status). Do not call Osi functions while a level is still loading.
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": {
"code": "<code>"
},
"name": "dos2_live_lua"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Lua source to run. Use return to send a value back, e.g. return Osi.CharacterGetHostCharacter(). | |
| timeout | No | Seconds to wait for the game's answer (default 5). |