mirror of
https://gitlab.com/4w/mtimer.git
synced 2024-11-28 10:13:50 +01:00
parent
abc8fd5b55
commit
b6db7ce7f8
3
init.lua
3
init.lua
@ -16,9 +16,6 @@ local S = minetest.get_translator('mtimer')
|
||||
mtimer = {
|
||||
translator = S,
|
||||
dialog = {},
|
||||
config = {
|
||||
manual_gc = minetest.settings:get_bool('mtimer_manual_gc', false)
|
||||
},
|
||||
meta = {
|
||||
visible = { key = 'mtimer:visible', default = 'true' },
|
||||
position = { key = 'mtimer:position', default = 'bl' },
|
||||
|
@ -1,10 +0,0 @@
|
||||
# Manual Lua garbage collection
|
||||
#
|
||||
# This setting addresses a bug that reportedly happens
|
||||
# on Windows. Lua seems to run out of memory. When this
|
||||
# setting is enabled mTimer runs the Lua garbage
|
||||
# collector automatically every 10 seconds.
|
||||
#
|
||||
# If you’re on Windows and your game does not crash
|
||||
# simply ignore this setting.
|
||||
mtimer_manual_gc (Perform manual Lua garbage collection) bool false
|
@ -1,6 +1,5 @@
|
||||
local m = mtimer
|
||||
local update_timer = m.update_timer
|
||||
local manual_gc = m.config.manual_gc
|
||||
local connected_players = minetest.get_connected_players
|
||||
local timer = 0
|
||||
|
||||
@ -18,15 +17,3 @@ minetest.register_globalstep(function(dtime)
|
||||
|
||||
timer = 0
|
||||
end)
|
||||
|
||||
|
||||
-- @see https://gitlab.com/4w/mtimer/issues/7
|
||||
if manual_gc == true then
|
||||
local gc_timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
gc_timer = gc_timer + dtime;
|
||||
if gc_timer < 10 then return end
|
||||
collectgarbage()
|
||||
gc_timer = 0
|
||||
end)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user