diff options
author | Tomas Brod <tomasbrod@azet.sk> | 2015-04-17 00:38:28 +0200 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-04-26 15:45:58 -0400 |
commit | 732eb72a0c4e2fb4632b0f42762d102e0d98dffa (patch) | |
tree | 418b827321e0a03a4020dccedb11955b238f255f /builtin | |
parent | 068d561a3c0e2f01f4ea9387b88b6f2b787dbbc1 (diff) | |
download | minetest-732eb72a0c4e2fb4632b0f42762d102e0d98dffa.tar.gz minetest-732eb72a0c4e2fb4632b0f42762d102e0d98dffa.tar.bz2 minetest-732eb72a0c4e2fb4632b0f42762d102e0d98dffa.zip |
Fix minetest.clear_* creating new LOCAL table instead of clearing the 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.
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/game/register.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/game/register.lua b/builtin/game/register.lua index f286113ec..cb0840241 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -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 |