summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/APIDump/_preload.lua
diff options
context:
space:
mode:
authorNiLSPACE <NiLSPACE@users.noreply.github.com>2024-11-04 23:43:20 +0100
committerGitHub <noreply@github.com>2024-11-04 23:43:20 +0100
commita99c3ec2b8eb8d8f2223e8175790539a675ffcac (patch)
tree454cf6ce029f475eecdac6f913f6c7af84462b53 /Server/Plugins/APIDump/_preload.lua
parentTemp fix for disappearing chunk sections in 1.14 (#5560) (diff)
downloadcuberite-master.tar
cuberite-master.tar.gz
cuberite-master.tar.bz2
cuberite-master.tar.lz
cuberite-master.tar.xz
cuberite-master.tar.zst
cuberite-master.zip
Diffstat (limited to 'Server/Plugins/APIDump/_preload.lua')
-rw-r--r--Server/Plugins/APIDump/_preload.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/Server/Plugins/APIDump/_preload.lua b/Server/Plugins/APIDump/_preload.lua
new file mode 100644
index 000000000..becc691c4
--- /dev/null
+++ b/Server/Plugins/APIDump/_preload.lua
@@ -0,0 +1,22 @@
+
+-- _preload.lua
+
+-- First thing executed when the plugin loads. Replaces the global environment (_G) with an empty table
+-- with __index set to the old environment. This way any function or variable that is created globally by the plugin
+-- won't be reported as new or undocumented.
+
+
+
+
+
+local newEnv, oldEnv = {}, _G
+local setmetatable = setmetatable
+for k, v in pairs(_G) do
+ newEnv[k] = v;
+ oldEnv[k] = nil;
+end
+_G = setmetatable(oldEnv, {__index = newEnv});
+
+
+
+