From 9f76f6ef2a1e1cdc950fb640bcf403d0cacf50c4 Mon Sep 17 00:00:00 2001 From: raymoo Date: Wed, 13 Jan 2016 16:56:06 -0800 Subject: [PATCH] Move os.time call out of loop --- init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 7a3f7ed..7dda5e8 100644 --- a/init.lua +++ b/init.lua @@ -297,8 +297,7 @@ local function add_hud(player, uid, disp_name, dur, icon) end -local function update_hud(player) - local now = os.time() +local function update_hud(now, player) local p_name = player:get_player_name() local p_huds = huds[p_name] @@ -729,9 +728,11 @@ end local function on_hud_timer() + local now = os.time() + for i, player in ipairs(minetest.get_connected_players()) do - update_hud(player) + update_hud(now, player) end end