You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Mekanome/scripts/lua-docs/get-docs.lua

58 lines
1.3 KiB

local dkjson = require("../../lib/dkjson/dkjson")
-- In their documentation code, blizzard uses some globals that we need to stub in else they'll be nil
CustomOptionTattoo = 0
CustomOptionTattooColor = 0
MAX_STABLE_SLOTS = 200
NUM_PET_SLOTS_THAT_NEED_LEARNED_SPELL = 5
EXTRA_PET_STABLE_SLOT = 5
Enum = {
PlayerCurrencyFlagsDbFlags = {
InBackpack = 0,
UnusedInUI = 0,
},
LFGRoleMeta = {
NumValues = 1
}
}
Constants = {
CharCustomizationConstants = {
CHAR_CUSTOMIZE_CUSTOM_DISPLAY_OPTION_LAST = 0,
CHAR_CUSTOMIZE_CUSTOM_DISPLAY_OPTION_FIRST = 0,
},
PetConsts = {
MAX_STABLE_SLOTS = 200,
NUM_PET_SLOTS_THAT_NEED_LEARNED_SPELL = 5,
EXTRA_PET_STABLE_SLOT = 5
}
}
-- End of stubs
local Tables = {}
APIDocumentation = {
AddDocumentationTable = function(self, doc)
Tables[#Tables+1] = doc
end
}
local directory = ...
for file in io.popen('ls "' .. directory .. '"'):lines() do
if file:match("^.+%.lua$") then
require(directory .. "/" .. file:gsub("%.lua$", ""))
end
end
local encoded = dkjson.encode(Tables)
local file = io.open("./scripts/lua-docs/docs/docs.json", "w")
if file and type(encoded) == 'string' then
file:write(encoded)
file:close()
print("Generated JSON for Lua Types.")
else
print("Unable to find file to write to.")
end