builtin module provides essential utilities that are built into the Talon runtime. These functions help with application lifecycle management, particularly during development with hot reload.
Import
Build Class
TheBuild class provides utilities for controlling the application lifecycle.
shouldStop()
Checks if the application should stop execution. This is primarily used with hot reload to detect when files have changed and the application needs to restart.Returns
true if the application should stop, false otherwiseHot Reload Integration
TheBuild.shouldStop() function is automatically triggered by Talon’s hot reload system when running with the --hot flag. When a Wren file is modified, the function returns true, causing the game loop to exit gracefully so Talon can reload and restart the application.
Without hot reload:
Always include
Build.shouldStop() in your game loop if you plan to use hot reload during development. This ensures your application can restart cleanly when files change.Common Patterns
Development vs Production
You can structure your code to only check for hot reload in development:Cleanup Before Reload
Perform cleanup operations when hot reload is triggered:See Also
Hot Reload
Learn about hot reload functionality
Game Loop
Understanding the game loop pattern