From 0c2f0ec68ee61e7a9fd64506b86f5d4a21571dd3 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Tue, 19 Dec 2023 09:04:29 +1100 Subject: [PATCH] fix(require): chunk name and error path for load/loadjson --- imports/require/shared.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/imports/require/shared.lua b/imports/require/shared.lua index 7d25ecf..12e71ad 100644 --- a/imports/require/shared.lua +++ b/imports/require/shared.lua @@ -66,9 +66,8 @@ function lib.load(filePath, env) local resourceFile = LoadResourceFile(resourceSrc, scriptPath) if resourceFile then - filePath = ('@@%s/%s'):format(resourceSrc, filePath) - local chunk, err = load(resourceFile, filePath, 't', env or _ENV) + local chunk, err = load(resourceFile, ('@@%s/%s'):format(resourceSrc, modpath), 't', env or _ENV) if not chunk or err then error(err or 'an unknown error occurred', 2) @@ -78,7 +77,7 @@ function lib.load(filePath, env) end end - error(('cannot load file at path %s'):format(filePath)) + error(('cannot load file at path %s'):format(modpath)) end ---@param filePath string @@ -104,7 +103,7 @@ function lib.loadJson(filePath) return json.decode(resourceFile) end - error(('cannot load json file at path %s'):format(filePath)) + error(('cannot load json file at path %s'):format(modpath)) end ---Loads the given module inside the current resource, returning any values returned by the file or `true` when `nil`.