From 476907a51628a0c6c56b5a39e72852d1e44940de Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 7 Feb 2011 17:38:22 +0100 Subject: [PATCH] Add number parameter to setAutoUpdate() --- init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index b49aacc..375a7db 100644 --- a/init.lua +++ b/init.lua @@ -157,7 +157,7 @@ local function share_group(shape, other) end local _love_update -function setAutoUpdate(max_step) +function setAutoUpdate(max_step, times) assert(_love_update == nil, "Auto update already enabled!") _love_update = love.update @@ -170,11 +170,14 @@ function setAutoUpdate(max_step) if max_step > 1 then -- assume it's a framerate max_step = 1 / max_step end + local times = time or 1 local combined_update = love.update love.update = function(dt) + local i = 1 while dt > max_step do combined_update(max_step) dt = dt - max_step + if i > times then return end end combined_update(dt) end