Potassium API
  • Environment
    • Cache
    • Closures
    • Console
    • Crypt
    • Debug
    • Drawing
    • File System
    • Input
    • Instance
    • Metatable
    • Miscellaneous
    • Scripts
    • Web Sockets
    • Actor
Powered by GitBook
On this page
  • readfile
  • listfiles
  • writefile
  • makefolder
  • appendfile
  • isfile
  • isfolder
  • delfile
  • delfolder
  • loadfile
  • dofile
  1. Environment

File System

readfile

<string> readfile(<string> path)

Returns the contents of the file located at path.


listfiles

<table<string>> listfiles(<string> path)

Returns a list of files and folders in the folder located at path. The returned list contains whole paths.


writefile

<nil> writefile(<string> path, <string> data)

Writes data to the file located at path if it is not a folder.


makefolder

<nil> makefolder(<string> path)

Creates a folder at path if it does not already exist.


appendfile

<nil> appendfile(<string> path, <string> data)

Appends data to the end of the file located at path. Creates the file if it does not exist.


isfile

<boolean> isfile(<string> path)

Returns whether or not path points to a file.


isfolder

<boolean> isfolder(<string> path)

Returns whether or not path points to a folder.


delfile

<nil> delfile(<string> path)

Removes the file located at path.


delfolder

<nil> delfolder(<string> path)

Removes the folder located at path.


loadfile

<function?, string?> loadfile(<string> path, <string?> chunkname)

Generates a chunk from the file located at path. The environment of the returned function is the global environment.

If there are no compilation errors, the chunk is returned by itself; otherwise, it returns nil plus the error message.

chunkname is used as the chunk name for error messages and debug information.


dofile

<nil> dofile(<string> path)

Attempts to load the file located at path and execute it on a new thread.


PreviousDrawingNextInput

Last updated 2 months ago