File tree Expand file tree Collapse file tree 6 files changed +147
-103
lines changed Expand file tree Collapse file tree 6 files changed +147
-103
lines changed Original file line number Diff line number Diff line change 1
1
--[[
2
2
Name: Evaluator.lua
3
3
Author: ByteXenon [Luna Gilbert]
4
- Date: 2024-02 -21
4
+ Date: 2024-05 -21
5
5
--]]
6
6
7
7
-- * Imports *--
Original file line number Diff line number Diff line change 1
1
--[[
2
2
Name: Helpers.lua
3
3
Author: ByteXenon [Luna Gilbert]
4
- Date: 2024-01-10
4
+ Date: 2024-05-21
5
5
--]]
6
6
7
7
-- * Imports *--
8
+ local char = string.char
9
+ local match = string.match
8
10
local gmatch = string.gmatch
9
11
local insert = table.insert
10
12
@@ -35,4 +37,18 @@ function Helpers.stringToTable(string)
35
37
return table
36
38
end
37
39
40
+ --- Converts a pattern to a character lookup table.
41
+ -- @param <String> pattern The pattern to convert.
42
+ -- @return <Table> table The table of characters.
43
+ function Helpers .createPatternLookupTable (pattern )
44
+ local lookupTable = {}
45
+ for i = 0 , 255 do
46
+ local character = char (i )
47
+ if match (character , pattern ) then
48
+ lookupTable [character ] = true
49
+ end
50
+ end
51
+ return lookupTable
52
+ end
53
+
38
54
return Helpers
You can’t perform that action at this time.
0 commit comments