summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2017-01-27 14:25:24 +0100
committerGitHub <noreply@github.com>2017-01-27 14:25:24 +0100
commitb872f9bef75b0d5946fdc973fb7e6fbe91b21cb8 (patch)
tree8ac81e5dc7735d1f276f71837eb1783f70ea246d
parentWorld: Remember the age persistently. (#3556) (diff)
parentApiDump: Added merge code to .luacheckrc (diff)
downloadcuberite-b872f9bef75b0d5946fdc973fb7e6fbe91b21cb8.tar
cuberite-b872f9bef75b0d5946fdc973fb7e6fbe91b21cb8.tar.gz
cuberite-b872f9bef75b0d5946fdc973fb7e6fbe91b21cb8.tar.bz2
cuberite-b872f9bef75b0d5946fdc973fb7e6fbe91b21cb8.tar.lz
cuberite-b872f9bef75b0d5946fdc973fb7e6fbe91b21cb8.tar.xz
cuberite-b872f9bef75b0d5946fdc973fb7e6fbe91b21cb8.tar.zst
cuberite-b872f9bef75b0d5946fdc973fb7e6fbe91b21cb8.zip
-rw-r--r--Server/Plugins/APIDump/main_APIDump.lua48
1 files changed, 47 insertions, 1 deletions
diff --git a/Server/Plugins/APIDump/main_APIDump.lua b/Server/Plugins/APIDump/main_APIDump.lua
index 624aed93b..608e57a69 100644
--- a/Server/Plugins/APIDump/main_APIDump.lua
+++ b/Server/Plugins/APIDump/main_APIDump.lua
@@ -1696,7 +1696,53 @@ globals =
end
end
- file:write("}\n")
+ file:write("}\n\n")
+
+ -- Add merge code
+ 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)
+ 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()
LOG("Config file .luacheckrc created...")