Skip to content

Commit 5deb057

Browse files
authored
Feature: Add LuaXen's Packer macros
1 parent 527acd8 commit 5deb057

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

src/MathParser.lua

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
--[[
22
Name: MathParser.lua
33
Author: ByteXenon [Luna Gilbert]
4-
Date: 2024-02-20
4+
Date: 2024-04-25
55
--]]
66

7-
-- Localize the path, so this file can be run from anywhere
8-
local scriptPath = (debug.getinfo(1).source:match("@?(.*/)") or "")
9-
local requirePath = scriptPath .. "./?.lua"
10-
local localPath = scriptPath .. "./"
11-
local oldPath = package.path
12-
package.path = package.path .. ";" .. requirePath
7+
local scriptPath, requirePath, localPath, oldPath
8+
if not LUAXEN_PACKER then
9+
-- Localize the path, so this file can be run from anywhere
10+
scriptPath = (debug.getinfo(1).source:match("@?(.*/)") or "")
11+
requirePath = scriptPath .. "./?.lua"
12+
localPath = scriptPath .. "./"
13+
oldPath = package.path
14+
package.path = package.path .. ";" .. requirePath
15+
end
1316

1417
--* Dependencies *--
1518
local Evaluator = require("Evaluator/Evaluator")
@@ -169,7 +172,9 @@ function MathParser:new(operatorPrecedenceLevels, variables, operatorFunctions,
169172
return MathParserInstance
170173
end
171174

172-
-- Reset package.path
173-
package.path = oldPath
175+
if not LUAXEN_PACKER then
176+
-- Reset package.path
177+
package.path = oldPath
178+
end
174179

175-
return MathParser
180+
return MathParser

0 commit comments

Comments
 (0)