Module RunnerFiles

A file access object used by a Game Runner program to read and write data files or programs to disk. It's only allowed to access files under the runners, bots/runners, and stages/runners subdirectories.

Functions

botExists (filename) Checks if a bot file exists.
exists (filename) Checks if a data file exists.
read (filename) Reads the contents of a data file.
readBot (filename) Reads the contents of a bot file.
readStage (filename) Reads the contents of a stage file.
stageExists (filename) Checks if a stage file exists.
write (filename, contents) Writes a data file to disk.
writeBot (filename, contents) Writes a bot file to disk.
writeStage (filename, contents) Writes a stage file to disk.


Functions

botExists (filename)

Checks if a bot file exists.

Parameters

  • filename: The name of the file under the bots/runners subdirectory.

Return value:

true if the file exists, false otherwise.
exists (filename)

Checks if a data file exists.

Parameters

  • filename: The name of the file under the runners subdirectory.

Return value:

true if the file exists, false otherwise.
read (filename)

Reads the contents of a data file.

Parameters

  • filename: The name of the file under the runners subdirectory.

Return value:

The contents of the file as a string, or nil if the file doesn't exist.
readBot (filename)

Reads the contents of a bot file.

Parameters

  • filename: The name of the file under the bots/runners subdirectory.

Return value:

The contents of the file as a string, or nil if the file doesn't exist.
readStage (filename)

Reads the contents of a stage file.

Parameters

  • filename: The name of the file under the stages/runners subdirectory.

Return value:

The contents of the file as a string, or nil if the file doesn't exist.
stageExists (filename)

Checks if a stage file exists.

Parameters

  • filename: The name of the file under the stages/runners subdirectory.

Return value:

true if the file exists, false otherwise.
write (filename, contents)

Writes a data file to disk.

Parameters

  • filename: The name of the file under the runners subdirectory.
  • contents: The contents of the file as a string.
writeBot (filename, contents)

Writes a bot file to disk.

Parameters

  • filename: The name of the file under the bots/runners subdirectory.
  • contents: The contents of the file as a string.
writeStage (filename, contents)

Writes a stage file to disk.

Parameters

  • filename: The name of the file under the stages/runners subdirectory.
  • contents: The contents of the file as a string.