From the reference libraryRedM

autodoc_shared_functions

jo_libs/modules/file/autodoc/autodoc_shared_functions.md

autodoc_shared_functions

JO Functions > jo.file.isExist() > Syntax

jo.file.isExist(...)

JO Functions > jo.file.isExist() > Parameters

modname : string

The file location

JO Functions > jo.file.isExist() > Return Value

Type : boolean

Returns true if the file exists, false otherwise

JO Functions > jo.file.isExist() > Example

local isExist = jo.file.isExist('module.fileName')
print(isExist)
-- OR --
local isExist = jo.file.isExist('@resource.folder.fileName')
print(isExist)

JO Functions > jo.file.load() > Syntax

jo.file.load(modname)

JO Functions > jo.file.load() > Parameters

modname : string

The file location

JO Functions > jo.file.load() > Return Value

Type : any

The result of the executed file, or false if there was an error

JO Functions > jo.file.load() > Example

local file = jo.file.load('module.fileName')
print('File loaded')
-- OR --
local isExist = jo.file.load('@resource.folder.fileName')
print('File loaded')


JO Functions > jo.file.read()

Read a file and return it if it's exist or false. The function accept one or two arguments. <br> One argument: the filepath <br> Two argument: the resource AND the filepath <br>

JO Functions > jo.file.read() > Syntax

jo.file.read(...)

JO Functions > jo.file.read() > Parameters

... : string

path of the file

JO Functions > jo.file.read() > Return Value

Type : file|boolean,resource|string,modpath|string

JO Functions > jo.file.read() > Example

local content,resource,modPath = jo.file.read('module.fileName')
print(content,resource,modPath)
-- OR --
local content,resource,modPath = jo.file.read('@resource.folder.fileName')
print(content,resource,modPath)

JO Functions > jo.file.loadJson()

Loads a JSON file and returns it decoded <br>

JO Functions > jo.file.loadJson() > Syntax

jo.file.loadJson(...)

JO Functions > jo.file.loadJson() > Parameters

... : string

path of the file, without the .json extension

JO Functions > jo.file.loadJson() > Return Value

Type : table|boolean

The decoded content of the file, or false if there was an error


JO Functions > jo.file.read() > Example

local content,resource,modPath = jo.file.read('module.fileName')
print(content,resource,modPath)
-- OR --
local content,resource,modPath = jo.file.read('@resource.folder.fileName')
print(content,resource,modPath)

JO Functions > jo.file.readJson()

Read a JSON file and return its content if it's exist or false. The function accept one or two arguments. <br> One argument: the filepath <br> Two argument: the resource AND the filepath <br>

JO Functions > jo.file.readJson() > Syntax

jo.file.readJson(...)

JO Functions > jo.file.readJson() > Parameters

... : string

path of the file, without the .json extension

JO Functions > jo.file.readJson() > Return Value

Type : file|boolean,resource|string,modpath|string

Back to documentation