Live records and the calling object
LESSON 14
Look up a character by ID and change only the record that the interaction concerns.
local Script = {}function Script.run(context)
local id = tostring(ActivePlayer())
if not Character:Has(id) then return "No active character" end
local actor = Character:Get(id)
local label = actor:Get("name", id)
Log("Active character: " .. tostring(label))
return tostring(label)
endreturn ScriptCharacter is a registry. Character:Get(id) returns a record proxy and actor:Get(path, fallback) reads
a field. Character.ada is a shortcut for a fixed ID. Bracketed or method-based lookup accommodates
IDs that contain a dash. player identifies the active character. this is the caller proxy when the
interaction supplies an owner. A manual run may have no meaningful owner.
Fragments for an authored actor and room#
Character.elias:Set("name", "Master Clockmaker")
await(AwaitCall(Character.elias, "Say", "Count the chimes."))
await(ActivateCamera({ cameraId = "wide", duration = 0.5 }))
await(ChangeScene({ sceneId = "archive", spawnId = "entrance" }))Create the referenced records first. Use colon syntax for a synchronous Godot object method. Use
AwaitCall for a yielding proxy method. The free-standing action wrappers take a Lua table. The
registry field list at the back describes which changes can update a live instance and which affect
its definition.
