-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathprometheus.lua
More file actions
72 lines (63 loc) · 1.66 KB
/
Copy pathprometheus.lua
File metadata and controls
72 lines (63 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
-- This Script is Part of the Prometheus Obfuscator by levno-710
--
-- prometheus.lua
--
-- This file is the entrypoint for Prometheus
-- Configure package.path for require
local function script_path()
local str = debug.getinfo(2, "S").source:sub(2)
return str:match("(.*[/%\\])")
end
local oldPkgPath = package.path;
package.path = script_path() .. "?.lua;" .. package.path;
-- Math.random Fix for Lua5.1
-- Check if fix is needed
if not pcall(function()
return math.random(1, 2^40);
end) then
local oldMathRandom = math.random;
math.random = function(a, b)
if not a and b then
return oldMathRandom();
end
if not b then
return math.random(1, a);
end
if a > b then
a, b = b, a;
end
local diff = b - a;
assert(diff >= 0);
if diff > 2 ^ 31 - 1 then
return math.floor(oldMathRandom() * diff + a);
else
return oldMathRandom(a, b);
end
end
end
-- newproxy polyfill
_G.newproxy = _G.newproxy or function(arg)
if arg then
return setmetatable({}, {});
end
return {};
end
-- Require Prometheus Submodules
local Pipeline = require("prometheus.pipeline");
local highlight = require("highlightlua");
local colors = require("colors");
local Logger = require("logger");
local Presets = require("presets");
local Config = require("config");
local util = require("prometheus.util");
-- Restore package.path
package.path = oldPkgPath;
-- Export
return {
Pipeline = Pipeline;
colors = colors;
Config = util.readonly(Config); -- Readonly
Logger = Logger;
highlight = highlight;
Presets = Presets;
}