Table of Contents

Lua API reference (game-server)

This page documents globals registered by ScriptSystem in src/game/script.rs.

Global Context userdata

Context is replaced per script execution.

DefaultScriptContextData

DialogScriptContextData

OnInteractionRequestedScriptContextData

OnKilledByEntityScriptContextData

OnEntityAttackedScriptContextData

Registered global functions

Interaction and messaging

Quest and dialog

Movement and world

Doors and vehicles

Inventory and equipment

Skills, cyberware, UI, and stats

Notes and gotchas

Minimal example

local common = require("common")
local Stat = require("stat")
 
local ent = Context:ent_id()
log("hello from lua, ent=" .. ent)
 
local hp = get_entity_stat_u32(ent, Stat.CurrentHealth)
if hp ~= nil and hp < 5 then
    common.open_modal("Warning", "Low HP", true, ent)
end