Skip to content

Commit 3e8b164

Browse files
committed
Added new Setting
1 parent 2d8a7fc commit 3e8b164

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/obfuscator/steps/ProxifyLocals.lua

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@ ProifyLocals.Description = "This Step wraps all locals into Proxy Objects";
1717
ProifyLocals.Name = "Proxify Locals";
1818

1919
ProifyLocals.SettingsDescriptor = {
20-
20+
LiteralType = {
21+
name = "LiteralType",
22+
description = "The type of the randomly generated literals",
23+
type = "enum",
24+
values = {
25+
"dictionary",
26+
"number",
27+
"string",
28+
"any",
29+
},
30+
default = "string",
31+
},
2132
}
2233

2334
local function shallowcopy(orig)
@@ -249,7 +260,17 @@ function ProifyLocals:apply(ast, pipeline)
249260
local localMetatableInfo = getLocalMetatableInfo(node.scope, node.id);
250261
-- Apply Only to Some Variables if Treshold is non 1
251262
if localMetatableInfo then
252-
return localMetatableInfo.getValue.constructor(node, RandomLiterals.Any());
263+
local literal;
264+
if self.LiteralType == "dictionary" then
265+
literal = RandomLiterals.Dictionary();
266+
elseif self.LiteralType == "number" then
267+
literal = RandomLiterals.Number();
268+
elseif self.LiteralType == "string" then
269+
literal = RandomLiterals.String(pipeline);
270+
else
271+
literal = RandomLiterals.Any(pipeline);
272+
end
273+
return localMetatableInfo.getValue.constructor(node, literal);
253274
end
254275
end
255276

0 commit comments

Comments
 (0)