mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46: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)
|
local resourceFile = LoadResourceFile(resourceSrc, scriptPath)
|
||||||
|
|
||||||
if resourceFile then
|
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
|
if not chunk or err then
|
||||||
error(err or 'an unknown error occurred', 2)
|
error(err or 'an unknown error occurred', 2)
|
||||||
@@ -78,7 +77,7 @@ function lib.load(filePath, env)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
error(('cannot load file at path %s'):format(filePath))
|
error(('cannot load file at path %s'):format(modpath))
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param filePath string
|
---@param filePath string
|
||||||
@@ -104,7 +103,7 @@ function lib.loadJson(filePath)
|
|||||||
return json.decode(resourceFile)
|
return json.decode(resourceFile)
|
||||||
end
|
end
|
||||||
|
|
||||||
error(('cannot load json file at path %s'):format(filePath))
|
error(('cannot load json file at path %s'):format(modpath))
|
||||||
end
|
end
|
||||||
|
|
||||||
---Loads the given module inside the current resource, returning any values returned by the file or `true` when `nil`.
|
---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