Remove update() from the L5 lifecycle#28
Draft
triss wants to merge 1 commit into
Draft
Conversation
update() was an optional, Processing-atypical callback that ran before draw() each frame. Combined with L5lua#26 (update() firing before setup() on startup), it's simpler to just drop it from the lifecycle entirely - L5's supported lifecycle is now setup() then draw(), matching Processing/p5.js. The per-frame framework bookkeeping that used to live alongside it (mouse position, deltaTime, key, video looping) still needs to run every frame regardless, so it's extracted into L5_internal.updateFrameState(dt) - internal plumbing, not a user-facing callback - called unconditionally from love.run's main loop. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a follow-up to #26. That fix made
update()fire strictly aftersetup(), but it's simpler to removeupdate()from the lifecycle entirely rather than keep juggling ordering around an optional, Processing-atypical callback.L5's supported lifecycle is now just:
matching Processing/p5.js, rather than:
Solution
update()callback and itsfunction love.update(dt)wrapper entirely.deltaTime,key, video looping) still needs to run every frame regardless ofupdate()'s existence, so it's been extracted intoL5_internal.updateFrameState(dt)- internal plumbing, not a user-facing callback - called unconditionally each frame fromlove.run's main loop, in the same placelove.update(dt)used to be called.examples/directory currently define/referenceupdate(), so this is a clean removal as far as the codebase is concerned.Caveat: conflicts with the planned
noWindow()/ headless-mode designChecked the docs site source (l5lua.org,
L5-website-gh-pages) for any documented reliance onupdate().reference/noCanvas/index.htmldocumentsupdate()as the required mechanism for headless sketches:with a sample sketch calling
noWindow()then definingupdate()to keep executing.However,
noWindow()/noCanvas()aren't implemented inL5.luaat all currently (confirmed via grep) - it's still an open item indocs/TODO.md([ ] add noWindow() for headless mode). So that documented example doesn't run today regardless of this change.That said, this PR removes the only mechanism the docs currently prescribe for keeping a sketch running once
noWindow()ships. Whoever implements headless mode will need to either reintroduce some form ofupdate()scoped to that case, or design/document a different way to keep code executing without a window. Flagging so it isn't silently lost - not blocking this PR, but should be considered before/alongside implementingnoWindow().Test plan
update()no longer has it called at all (state set inupdate()never takes effect)mouseX,mouseY,deltaTime, andkeystill update correctly every frame viaL5_internal.updateFrameStatemain.luaexample sketch to confirm no regression in normal draw-loop behaviorupdate()- only the (currently non-functional)noCanvas()example, noted above