From d37911fec1212ebd33b75b90d041e2883b9f8547 Mon Sep 17 00:00:00 2001 From: Tristan Strange Date: Thu, 23 Jul 2026 14:01:39 +0100 Subject: [PATCH] Remove update() from the L5 lifecycle update() was an optional, Processing-atypical callback that ran before draw() each frame. Combined with #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 --- L5.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/L5.lua b/L5.lua index 02e7ba1..4730fe3 100644 --- a/L5.lua +++ b/L5.lua @@ -51,9 +51,9 @@ function love.run() -- Update dt if love.timer then dt = love.timer.step() end - -- Update - if love.update then love.update(dt) end - + -- Refresh per-frame framework state (mouse position, deltaTime, key, video looping) + L5_internal.updateFrameState(dt) + -- Draw with double buffering if love.graphics and love.graphics.isActive() then love.graphics.origin() @@ -164,7 +164,10 @@ function love.load() fill(255) end -function love.update(dt) +-- Per-frame framework bookkeeping (mouse position, deltaTime, key, video +-- looping). update() is not part of the L5 lifecycle - only setup() and +-- draw() are - so this is purely internal plumbing, not a user callback. +function L5_internal.updateFrameState(dt) mouseX, mouseY = love.mouse.getPosition() movedX=mouseX-pmouseX movedY=mouseY-pmouseY @@ -182,9 +185,6 @@ function love.update(dt) end end end - - -- Optional update (not typically Processing-like but available) - if update ~= nil then update() end end function love.draw() @@ -849,7 +849,7 @@ function L5_internal.defaults() TRIANGLE_STRIP = "strip" -- global user vars - can be read by user but shouldn't be altered by user - key = "" --default, overriden with key presses detected in love.update(dt) + key = "" --default, overriden with key presses detected in L5_internal.updateFrameState(dt) width = 800 --default, overridden with size() or fullscreen() height = 600 --ditto frameCount = 0