Sandbox: Lua: File - ov-studio/Vital.sandbox Wiki

━ What's the Objective?

File module simulates file system as may have been observed in other languages (Javascript for example). Custom file manager module was essentially needed for sandbox implementation.

━ APIs

━ file.resolve() (Shared)

@Objective: Resolves & returns resolved path.
local string: result = file.resolve(
  string: path
)

━ file.exists() (Shared)

@Objective: Verifies whether the specified file exists.
local bool: result = file.exists(
  string: path
)

━ file.size() (Shared)

@Objective: Retrieves size of file.
local int: result = file.size(
  string: path
)

━ file.delete() (Shared)

@Objective: Deletes the specified file.
local bool: result = file.delete(
  string: path
)

━ file.read() (Shared)

@Objective: Retrieves specified path's buffer data.
local string: result = file.read(
  string: path
)

━ file.write() (Shared)

@Objective: Writes buffer data to a specified path.
local bool: result = file.write(
  string: path,
  string: data
)

━ file.contents() (Shared)

@Objective: Retrieves content of specified path.
local table: result = file.contents(
  string: path,
  bool: fetchDirs
)