mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
fix(require): chunk name and error path for load/loadjson
This commit is contained in:
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user