Move os.time call out of loop
This commit is contained in:
parent
bcc0dfb47c
commit
9f76f6ef2a
7
init.lua
7
init.lua
@ -297,8 +297,7 @@ local function add_hud(player, uid, disp_name, dur, icon)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function update_hud(player)
|
local function update_hud(now, player)
|
||||||
local now = os.time()
|
|
||||||
local p_name = player:get_player_name()
|
local p_name = player:get_player_name()
|
||||||
local p_huds = huds[p_name]
|
local p_huds = huds[p_name]
|
||||||
|
|
||||||
@ -729,9 +728,11 @@ end
|
|||||||
|
|
||||||
local function on_hud_timer()
|
local function on_hud_timer()
|
||||||
|
|
||||||
|
local now = os.time()
|
||||||
|
|
||||||
for i, player in ipairs(minetest.get_connected_players()) do
|
for i, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
|
||||||
update_hud(player)
|
update_hud(now, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user