Skip to content

Commit

Permalink
Fix minetest.clear_* creating new LOCAL table instead of clearing the…
Browse files Browse the repository at this point in the history
… existing one.

On calling clear_redistered_biomes the registered_biomes table is cleared
by creating a new empty table, but the pointer is not updated to point to
the new one. So after calling more register_biome, the registered_biome
table always contains 0 items, which is an error. Instead, the table is
cleared by removing all its items so the pointer (minetest.registered_*)
remains valid.
  • Loading branch information
tomasbrod authored and kwolekr committed Apr 26, 2015
1 parent 068d561 commit 732eb72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion builtin/game/register.lua
Expand Up @@ -398,7 +398,9 @@ local function make_registration_wrap(reg_fn_name, clear_fn_name)

local orig_clear_fn = core[clear_fn_name]
core[clear_fn_name] = function()
list = {}
for k in pairs(list) do
list[k] = nil
end
return orig_clear_fn()
end

Expand Down

0 comments on commit 732eb72

Please sign in to comment.