Skip to reading
Lua Scripting

Pause a Lua function on a line

Edition 0.86.4.7

0.86.4.7 tutorial edition with new lessons for Studio 0.86.4.6 and 0.86.4.7. Earlier chapters, screenshots and registry figures retain their stated edition context.

Download PDFView illustrations

Lua scripting

STUDIO 0.86.4.6 • LESSON 1 OF 4

Follow the shipped Lua example to see the inputs before the function returns 60.

1. Start the example from Studio

Open examples/workbenches/Clock-and-Debugging.pca3d. In Output & Diagnostics, choose Debug & Profile → Line debugger. Select Lua, then gear_lua. Set the function to run and enter [] for arguments. Leave Play game clear for this first run.

2. Set a breakpoint and inspect the frame

Click the gutter beside executable line 4, then click Start. When the line is highlighted, check which script and line appear in the paused frame. Choose a regular Lua source record. In this workbench the local teeth is 12 before the multiplication. Use Into when you want to follow a function call and Over when you want to stay at the caller’s level.

3. Finish and repeat

Click Continue to finish. For a desktop game-triggered check, use Play game before Start and trigger the action from the running game. Lua and GDScript line debugging require a desktop Godot 4.7.2 executable available to Studio. In a packaged editor, set it under Build Tools.

A real Lua pause in the workbench. The source gutter and step controls occupy the same places for the other languages.

WHAT TO CHECK

Run the matching example in Regression tests and verify that the expected return is 60. If a breakpoint never fires, check that you selected the exact language, script ID and entry function and that the line has executable code.

Related original lesson | p. 85 Tutorial edition 0.86.4.7

Page 134 of 137Permalink
Go to page