Skip to content

Commit e6cf3df

Browse files
committed
Fixed spelling issue
1 parent 201ea73 commit e6cf3df

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

src/obfuscator/steps/SplitStrings.lua

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ SplitStrings.SettingsDescriptor = {
4444
},
4545
ConcatenationType = {
4646
name = "ConcatenationType",
47-
description = "The Functions used for Concatenation. Note that when using coustom, the String Array will also be Shuffled",
47+
description = "The Functions used for Concatenation. Note that when using custom, the String Array will also be Shuffled",
4848
type = "enum",
4949
values = {
5050
"strcat",
5151
"table",
52-
"coustom",
52+
"custom",
5353
},
54-
default = "coustom",
54+
default = "custom",
5555
},
56-
CoustomFunctionType = {
57-
name = "CoustomFunctionType",
58-
description = "The Type of Function code injection This Option only applies when coustom Concatenation is selected.\
56+
CustomFunctionType = {
57+
name = "CustomFunctionType",
58+
description = "The Type of Function code injection This Option only applies when custom Concatenation is selected.\
5959
Note that when chosing inline, the code size may increase significantly!",
6060
type = "enum",
6161
values = {
@@ -65,9 +65,9 @@ Note that when chosing inline, the code size may increase significantly!",
6565
},
6666
default = "global",
6767
},
68-
CoustomLocalFunctionsCount = {
69-
name = "CoustomLocalFunctionsCount",
70-
description = "The number of local functions per scope. This option only applies when CoustomFunctionType = local",
68+
CustomLocalFunctionsCount = {
69+
name = "CustomLocalFunctionsCount",
70+
description = "The number of local functions per scope. This option only applies when CustomFunctionType = local",
7171
type = "number",
7272
default = 2,
7373
min = 1,
@@ -98,9 +98,9 @@ local function generateStrCatNode(chunks)
9898
return generatedNode
9999
end
100100

101-
local coustomVariants = 2;
102-
local coustom1Code = [=[
103-
function coustom(table)
101+
local customVariants = 2;
102+
local custom1Code = [=[
103+
function custom(table)
104104
local stringTable, str = table[#table], "";
105105
for i=1,#stringTable, 1 do
106106
str = str .. stringTable[table[i]];
@@ -109,8 +109,8 @@ function coustom(table)
109109
end
110110
]=];
111111

112-
local coustom2Code = [=[
113-
function coustom(tb)
112+
local custom2Code = [=[
113+
function custom(tb)
114114
local str = "";
115115
for i=1, #tb / 2, 1 do
116116
str = str .. tb[#tb / 2 + tb[i]];
@@ -119,7 +119,7 @@ function coustom(tb)
119119
end
120120
]=];
121121

122-
local function generateCoustomNodeArgs(chunks, data, variant)
122+
local function generateCustomNodeArgs(chunks, data, variant)
123123
local shuffled = {};
124124
local shuffledIndices = {};
125125
for i = 1, #chunks, 1 do
@@ -131,7 +131,7 @@ local function generateCoustomNodeArgs(chunks, data, variant)
131131
shuffled[v] = chunks[i];
132132
end
133133

134-
-- Coustom Function Type 1
134+
-- Custom Function Type 1
135135
if variant == 1 then
136136
local args = {};
137137
local tbNodes = {};
@@ -149,7 +149,7 @@ local function generateCoustomNodeArgs(chunks, data, variant)
149149
table.insert(args, Ast.TableEntry(tb));
150150
return {Ast.TableConstructorExpression(args)};
151151

152-
-- Coustom Function Type 2
152+
-- Custom Function Type 2
153153
else
154154

155155
local args = {};
@@ -164,57 +164,57 @@ local function generateCoustomNodeArgs(chunks, data, variant)
164164

165165
end
166166

167-
local function generateCoustomFunctionLiteral(parentScope, variant)
167+
local function generateCustomFunctionLiteral(parentScope, variant)
168168
local parser = Parser:new({
169169
LuaVersion = LuaVersion.Lua52;
170170
});
171171

172-
-- Coustom Function Type 1
172+
-- Custom Function Type 1
173173
if variant == 1 then
174-
local funcDeclNode = parser:parse(coustom1Code).body.statements[1];
174+
local funcDeclNode = parser:parse(custom1Code).body.statements[1];
175175
local funcBody = funcDeclNode.body;
176176
local funcArgs = funcDeclNode.args;
177177
funcBody.scope:setParent(parentScope);
178178
return Ast.FunctionLiteralExpression(funcArgs, funcBody);
179179

180-
-- Coustom Function Type 2
180+
-- Custom Function Type 2
181181
else
182-
local funcDeclNode = parser:parse(coustom2Code).body.statements[1];
182+
local funcDeclNode = parser:parse(custom2Code).body.statements[1];
183183
local funcBody = funcDeclNode.body;
184184
local funcArgs = funcDeclNode.args;
185185
funcBody.scope:setParent(parentScope);
186186
return Ast.FunctionLiteralExpression(funcArgs, funcBody);
187187
end
188188
end
189189

190-
local function generateGlobalCoustomFunctionDeclaration(ast, data)
190+
local function generateGlobalCustomFunctionDeclaration(ast, data)
191191
local parser = Parser:new({
192192
LuaVersion = LuaVersion.Lua52;
193193
});
194194

195-
-- Coustom Function Type 1
196-
if data.coustomFunctionVariant == 1 then
195+
-- Custom Function Type 1
196+
if data.customFunctionVariant == 1 then
197197
local astScope = ast.body.scope;
198-
local funcDeclNode = parser:parse(coustom1Code).body.statements[1];
198+
local funcDeclNode = parser:parse(custom1Code).body.statements[1];
199199
local funcBody = funcDeclNode.body;
200200
local funcArgs = funcDeclNode.args;
201201
funcBody.scope:setParent(astScope);
202-
return Ast.LocalVariableDeclaration(astScope, {data.coustomFuncId},
202+
return Ast.LocalVariableDeclaration(astScope, {data.customFuncId},
203203
{Ast.FunctionLiteralExpression(funcArgs, funcBody)});
204-
-- Coustom Function Type 2
204+
-- Custom Function Type 2
205205
else
206206
local astScope = ast.body.scope;
207-
local funcDeclNode = parser:parse(coustom2Code).body.statements[1];
207+
local funcDeclNode = parser:parse(custom2Code).body.statements[1];
208208
local funcBody = funcDeclNode.body;
209209
local funcArgs = funcDeclNode.args;
210210
funcBody.scope:setParent(astScope);
211-
return Ast.LocalVariableDeclaration(data.coustomFuncScope, {data.coustomFuncId},
211+
return Ast.LocalVariableDeclaration(data.customFuncScope, {data.customFuncId},
212212
{Ast.FunctionLiteralExpression(funcArgs, funcBody)});
213213
end
214214
end
215215

216216
function SplitStrings:variant()
217-
return math.random(1, coustomVariants);
217+
return math.random(1, customVariants);
218218
end
219219

220220
function SplitStrings:apply(ast, pipeline)
@@ -226,28 +226,28 @@ function SplitStrings:apply(ast, pipeline)
226226
local id = scope:addVariable();
227227
data.tableConcatScope = scope;
228228
data.tableConcatId = id;
229-
elseif(self.ConcatenationType == "coustom") then
230-
data.coustomFunctionType = self.CoustomFunctionType;
231-
if data.coustomFunctionType == "global" then
229+
elseif(self.ConcatenationType == "custom") then
230+
data.customFunctionType = self.CustomFunctionType;
231+
if data.customFunctionType == "global" then
232232
local scope = ast.body.scope;
233233
local id = scope:addVariable();
234-
data.coustomFuncScope = scope;
235-
data.coustomFuncId = id;
236-
data.coustomFunctionVariant = self:variant();
234+
data.customFuncScope = scope;
235+
data.customFuncId = id;
236+
data.customFunctionVariant = self:variant();
237237
end
238238
end
239239

240240

241-
local coustomLocalFunctionsCount = self.CoustomLocalFunctionsCount;
241+
local customLocalFunctionsCount = self.CustomLocalFunctionsCount;
242242
local self2 = self;
243243

244244
visitAst(ast, function(node, data)
245245
-- Previsit Function
246246

247247
-- Create Local Function declarations
248-
if(self.ConcatenationType == "coustom" and data.coustomFunctionType == "local" and node.kind == Ast.AstKind.Block and node.isFunctionBlock) then
248+
if(self.ConcatenationType == "custom" and data.customFunctionType == "local" and node.kind == Ast.AstKind.Block and node.isFunctionBlock) then
249249
data.functionData.localFunctions = {};
250-
for i = 1, coustomLocalFunctionsCount, 1 do
250+
for i = 1, customLocalFunctionsCount, 1 do
251251
local scope = data.scope;
252252
local id = scope:addVariable();
253253
local variant = self:variant();
@@ -263,11 +263,11 @@ function SplitStrings:apply(ast, pipeline)
263263
end, function(node, data)
264264
-- PostVisit Function
265265

266-
-- Create actual function literals for local coustomFunctionType
267-
if(self.ConcatenationType == "coustom" and data.coustomFunctionType == "local" and node.kind == Ast.AstKind.Block and node.isFunctionBlock) then
266+
-- Create actual function literals for local customFunctionType
267+
if(self.ConcatenationType == "custom" and data.customFunctionType == "local" and node.kind == Ast.AstKind.Block and node.isFunctionBlock) then
268268
for i, func in ipairs(data.functionData.localFunctions) do
269269
if func.used then
270-
local literal = generateCoustomFunctionLiteral(func.scope, func.variant);
270+
local literal = generateCustomFunctionLiteral(func.scope, func.variant);
271271
table.insert(node.statements, 1, Ast.LocalVariableDeclaration(func.scope, {func.id}, {literal}));
272272
end
273273
end
@@ -293,25 +293,25 @@ function SplitStrings:apply(ast, pipeline)
293293
node = generateStrCatNode(chunks);
294294
elseif self.ConcatenationType == "table" then
295295
node = generateTableConcatNode(chunks, data);
296-
elseif self.ConcatenationType == "coustom" then
297-
if self.CoustomFunctionType == "global" then
298-
local args = generateCoustomNodeArgs(chunks, data, data.coustomFunctionVariant);
296+
elseif self.ConcatenationType == "custom" then
297+
if self.CustomFunctionType == "global" then
298+
local args = generateCustomNodeArgs(chunks, data, data.customFunctionVariant);
299299
-- Add Reference for Variable Renaming
300-
data.scope:addReferenceToHigherScope(data.coustomFuncScope, data.coustomFuncId);
301-
node = Ast.FunctionCallExpression(Ast.VariableExpression(data.coustomFuncScope, data.coustomFuncId), args);
302-
elseif self.CoustomFunctionType == "local" then
300+
data.scope:addReferenceToHigherScope(data.customFuncScope, data.customFuncId);
301+
node = Ast.FunctionCallExpression(Ast.VariableExpression(data.customFuncScope, data.customFuncId), args);
302+
elseif self.CustomFunctionType == "local" then
303303
local lfuncs = data.functionData.localFunctions;
304304
local idx = math.random(1, #lfuncs);
305305
local func = lfuncs[idx];
306-
local args = generateCoustomNodeArgs(chunks, data, func.variant);
306+
local args = generateCustomNodeArgs(chunks, data, func.variant);
307307
func.used = true;
308308
-- Add Reference for Variable Renaming
309309
data.scope:addReferenceToHigherScope(func.scope, func.id);
310310
node = Ast.FunctionCallExpression(Ast.VariableExpression(func.scope, func.id), args);
311-
elseif self.CoustomFunctionType == "inline" then
311+
elseif self.CustomFunctionType == "inline" then
312312
local variant = self:variant();
313-
local args = generateCoustomNodeArgs(chunks, data, variant);
314-
local literal = generateCoustomFunctionLiteral(data.scope, variant);
313+
local args = generateCustomNodeArgs(chunks, data, variant);
314+
local literal = generateCustomFunctionLiteral(data.scope, variant);
315315
node = Ast.FunctionCallExpression(literal, args);
316316
end
317317
end
@@ -329,8 +329,8 @@ function SplitStrings:apply(ast, pipeline)
329329
ast.body.scope:addReferenceToHigherScope(globalScope, tableId);
330330
table.insert(ast.body.statements, 1, Ast.LocalVariableDeclaration(data.tableConcatScope, {data.tableConcatId},
331331
{Ast.IndexExpression(Ast.VariableExpression(tableScope, tableId), Ast.StringExpression("concat"))}));
332-
elseif(self.ConcatenationType == "coustom" and self.CoustomFunctionType == "global") then
333-
table.insert(ast.body.statements, 1, generateGlobalCoustomFunctionDeclaration(ast, data));
332+
elseif(self.ConcatenationType == "custom" and self.CustomFunctionType == "global") then
333+
table.insert(ast.body.statements, 1, generateGlobalCustomFunctionDeclaration(ast, data));
334334
end
335335
end
336336

0 commit comments

Comments
 (0)