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/dist/_index.lua

82 lines
2.5 KiB

--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
-- Lua Library inline imports
local function __TS__ObjectKeys(obj)
local result = {}
local len = 0
for key in pairs(obj) do
len = len + 1
result[len] = key
end
return result
end
local function __TS__ArrayForEach(self, callbackFn, thisArg)
for i = 1, #self do
callbackFn(thisArg, self[i], i - 1, self)
end
end
-- End of Lua Library inline imports
local ____exports = {}
local _Tinkr = ...
local Tinkr = _Tinkr
local function Print(____bindingPattern0)
local color
local level
local prefix
local text
text = ____bindingPattern0.text
prefix = ____bindingPattern0.prefix
level = ____bindingPattern0.level
color = ____bindingPattern0.color
local textColor = color
if not textColor then
textColor = level == "error" and "FF76CE" or (level == "info" and "94FFD8" or (level == "warn" and "FDFFC2" or "A3D8FF"))
end
print((((("|cFF" .. textColor) .. "[") .. (prefix or "Mekanome")) .. "]|r |cFFFFFFFF ") .. text)
end
local function GetObject(token)
return Object(token)
end
local function Error(text)
Print({text = text, prefix = "ERROR", level = "error"})
error(text)
end
local Mekanome = {enabled = false, Print = Print, Error = Error, GetObject = GetObject}
local function Load(path)
return Tinkr.Util.Evaluator:LoadString(
Tinkr.Util.File:Read(path),
{Tinkr, Mekanome},
path
).default
end
local function LoadDirectoryFiles(path)
local directories = ListDirectories(path)
for ____, directory in ipairs(directories) do
LoadDirectoryFiles((path .. "/") .. directory)
end
local files = ListFiles(path)
for ____, file in ipairs(files) do
Load((path .. "/") .. file)
Print({text = (path .. "/") .. file, prefix = "Loaded"})
end
end
local function Init()
Print({text = "(V) (°,,,,°) (V)"})
LoadDirectoryFiles("scripts/utils")
LoadDirectoryFiles("scripts/managers")
LoadDirectoryFiles("scripts/actions")
local keys = __TS__ObjectKeys(Mekanome)
__TS__ArrayForEach(
keys,
function(____, key)
local module = Mekanome[key]
if module ~= nil and type(module) == "table" and module.Init ~= nil then
module:Init()
Print({text = key, prefix = "Initialized", level = "info"})
end
end
)
end
Init()
____exports.default = {}
return ____exports