Use Godot from a Lua record
LESSON 19
Draw a temporary overlay using Godot controls. Keep the node alive until the timer finishes, then free it.
local Script = {}function Script.run(context)
local layer = ClassDB:instantiate("CanvasLayer")
Runtime:add_child(layer)
local swatch = ClassDB:instantiate("ColorRect")
swatch.color = Color(0.08, 0.29, 0.34, 1.0)
swatch.position = Vector2(24, 32)
swatch.size = Vector2(270, 48)
layer:add_child(swatch)
local label = ClassDB:instantiate("Label")
label.text = "Archive signal received"
label.position = Vector2(12, 8)
swatch:add_child(label)
await(Wait(1.5))
layer:queue_free()
return true
endreturn ScriptRun from a game session. A teal rectangle with a label appears near the top left, then disappears.
CanvasLayer draws its control children in screen space. The rectangle owns the label in the scene
tree. Freeing the layer frees the temporary controls together. For production HUDs, set mouse_filter
to ignore on decorative controls that would otherwise intercept clicks.
Godot values use constructors such as Vector2 and Color. Godot objects expose methods through
Lua's colon syntax. For persistent native nodes, choose a parent whose lifetime matches the
feature. A separately authored Godot drawing class can implement _draw and be called from Lua
through a native PCA record when the overlay needs custom drawing.
