aboutsummaryrefslogtreecommitdiff
path: root/builtin/deprecated.lua
diff options
context:
space:
mode:
authorWeblate <42@minetest.ru>2013-06-01 13:18:52 +0200
committerWeblate <42@minetest.ru>2013-06-01 13:18:52 +0200
commit1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124 (patch)
tree54660f353f3342f89b6259ea6a5dfedfa20dc16f /builtin/deprecated.lua
parentec039a3d123120f9918812b13f5971e94546b9af (diff)
parent64627817fcca52f20948c24b60ce192b218f6ce2 (diff)
downloadminetest-1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124.tar.gz
minetest-1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124.tar.bz2
minetest-1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'builtin/deprecated.lua')
-rw-r--r--builtin/deprecated.lua22
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
+})