diff options
Diffstat (limited to 'builtin/deprecated.lua')
-rw-r--r-- | builtin/deprecated.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/builtin/deprecated.lua b/builtin/deprecated.lua index 405ce3b09..23ab38675 100644 --- a/builtin/deprecated.lua +++ b/builtin/deprecated.lua @@ -24,3 +24,25 @@ minetest.add_to_creative_inventory = function(itemstring) minetest.log('info', "WARNING: minetest.add_to_creative_inventory: This function is deprecated and does nothing.") end +-- +-- EnvRef +-- +minetest.env = {} +local envref_deprecation_message_printed = false +setmetatable(minetest.env, { + __index = function(table, key) + if not envref_deprecation_message_printed then + minetest.log("info", "WARNING: minetest.env:[...] is deprecated and should be replaced with minetest.[...]") + envref_deprecation_message_printed = true + end + local func = minetest[key] + if type(func) == "function" then + rawset(table, key, function(self, ...) + return func(unpack({...})) + end) + else + rawset(table, key, nil) + end + return rawget(table, key) + end +}) |