1
1
--[[
2
2
Name: MathParser.lua
3
3
Author: ByteXenon [Luna Gilbert]
4
- Date: 2024-04-25
4
+ Date: 2024-06-14
5
5
--]]
6
6
7
7
local scriptPath , requirePath , localPath , oldPath
@@ -15,9 +15,13 @@ if not LUAXEN_PACKER then
15
15
end
16
16
17
17
-- * Dependencies *--
18
+ local Helpers = require (" Helpers/Helpers" )
18
19
local Evaluator = require (" Evaluator/Evaluator" )
19
- local Lexer = require (" Lexer/Lexer" )
20
- local Parser = require (" Parser/Parser" )
20
+ local Lexer = require (" Lexer/Lexer" )
21
+ local Parser = require (" Parser/Parser" )
22
+
23
+ -- * Imports *--
24
+ local inheritModule = Helpers .inheritModule
21
25
22
26
-- * MathParserMethods *--
23
27
local MathParserMethods = {}
@@ -157,17 +161,8 @@ function MathParser:new(operatorPrecedenceLevels, variables, operatorFunctions,
157
161
MathParserInstance .Parser = Parser :new (nil , operatorPrecedenceLevels )
158
162
MathParserInstance .Evaluator = Evaluator :new (nil , variables , operatorFunctions , functions )
159
163
160
- local function inheritModule (moduleName , moduleTable )
161
- for index , value in pairs (moduleTable ) do
162
- if MathParserInstance [index ] then
163
- return error (" Conflicting names in " .. moduleName .. " and MathParserInstance: " .. index )
164
- end
165
- MathParserInstance [index ] = value
166
- end
167
- end
168
-
169
164
-- Main
170
- inheritModule (" MathParserMethods" , MathParserMethods )
165
+ inheritModule (" MathParserInstance " , MathParserInstance , " MathParserMethods" , MathParserMethods )
171
166
172
167
return MathParserInstance
173
168
end
0 commit comments