summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2017-01-29 12:27:32 +0100
committerGitHub <noreply@github.com>2017-01-29 12:27:32 +0100
commit77f456fc98f20a5922c74c135a77c35f9baba9a4 (patch)
tree96c620ae33371343fb6ceded1964cb56b40ee758
parentChanged big flowers so they don't need air above them. (diff)
parentAPIDump: Corrected luacheck file to load a plugin's luacheck if exists (diff)
downloadcuberite-77f456fc98f20a5922c74c135a77c35f9baba9a4.tar
cuberite-77f456fc98f20a5922c74c135a77c35f9baba9a4.tar.gz
cuberite-77f456fc98f20a5922c74c135a77c35f9baba9a4.tar.bz2
cuberite-77f456fc98f20a5922c74c135a77c35f9baba9a4.tar.lz
cuberite-77f456fc98f20a5922c74c135a77c35f9baba9a4.tar.xz
cuberite-77f456fc98f20a5922c74c135a77c35f9baba9a4.tar.zst
cuberite-77f456fc98f20a5922c74c135a77c35f9baba9a4.zip
-rw-r--r--Server/Plugins/APIDump/main_APIDump.lua51
1 files changed, 16 insertions, 35 deletions
diff --git a/Server/Plugins/APIDump/main_APIDump.lua b/Server/Plugins/APIDump/main_APIDump.lua
index 608e57a69..b45f98a45 100644
--- a/Server/Plugins/APIDump/main_APIDump.lua
+++ b/Server/Plugins/APIDump/main_APIDump.lua
@@ -1702,45 +1702,26 @@ globals =
file:write([[
-- ## Main ##
-function WriteTable(a_File, a_TableName)
- a_File:write(a_TableName, " = \n{\n")
- for _, Entry in ipairs(_G[a_TableName]) do
- a_File:write("\t\"", Entry, "\",\n")
- end
- a_File:write("}\n\n")
-end
-
-- Load plugins's luacheck
-local FilePluginLuacheck = assert(loadfile(".plugin_luacheck"))
-local PluginLuacheck = {}
-setfenv(FilePluginLuacheck, PluginLuacheck)
-FilePluginLuacheck()
-
-for Option, Value in pairs(PluginLuacheck) do
- if (type(Value) == "table") and not(_G[Option] == nil) then
- -- Merge tables together
- for _ , Entry in ipairs(Value) do
- table.insert(_G[Option], Entry)
+local FilePluginLuacheck = loadfile(".luacheckrc_plugin")
+
+if FilePluginLuacheck ~= nil then
+ local PluginLuacheck = {}
+ setfenv(FilePluginLuacheck, PluginLuacheck)
+ FilePluginLuacheck()
+
+ for Option, Value in pairs(PluginLuacheck) do
+ if (type(Value) == "table") and not(getfenv(1)[Option] == nil) then
+ -- Merge tables together
+ for _ , Entry in ipairs(Value) do
+ table.insert(getfenv(1)[Option], Entry)
+ end
+ else
+ -- Add a option, table or overwrite a option
+ getfenv(1)[Option] = Value
end
- else
- -- Add a option, table or overwrite a option
- _G[Option] = Value
end
end
-
--- Write to file .luacheckrc
-local FileLuacheckAll = io.open(".luacheckrc", "w")
-
--- Add options
-FileLuacheckAll:write("unused_args", " = ", tostring(unused_args), "\n\n")
-FileLuacheckAll:write("allow_defined", " = ", tostring(allow_defined), "\n\n")
-
--- Write tables
-WriteTable(FileLuacheckAll, "globals")
-WriteTable(FileLuacheckAll, "ignore")
-WriteTable(FileLuacheckAll, "exclude_files")
-
-FileLuacheckAll:close()
]])
file:close()