RbxStu V3 Docs
  • Welcome
  • Information
    • Engine Information
      • Luau API Security
  • Stunc
    • Overview
    • Connections
    • Filesystem
      • readfile
      • writefile
      • appendfile
      • isfile
      • isfolder
      • listfiles
      • makefolder
      • delfile
      • delfolder
      • loadfile
      • dofile
  • Memory
    • getgc
    • reference_object
    • unreference_object
    • get_gc_threshold
  • Closures
    • isunhookable
    • makeunhookable
    • ishooked
    • restorefunction
    • hookfunction
    • hookmetamethod
    • isourclosure
    • iscclosure
    • islclosure
    • clonefunction
    • newcclosure
    • newlclosure
    • loadstring
Powered by GitBook
On this page
  1. Stunc
  2. Filesystem

listfiles

Overview of the listfiles function.

Function definition
function listfiles(path: string): { string }

Errors:

  • Illegal Path

    • The path provided is considered 'unsafe'.

Remarks

Whilst it may seem that listfilesimplies that only files will be enumerated, in reality, both files and folders will be enumerated.

High-Level Overview:

The listfiles function follows the already defined UNC specification; it will return all the folders found at the provided path.

Low-Level Overview:

pathis read from the luau heap, then utilising std::filesystem::is_directorywe validate if the provided path (once sanitised) is pointing to a valid folder in the filesystem; if it is, then we use an std::filesystem::directory_iterator. and push the paths of the files found to the array that is returned.

PreviousisfolderNextmakefolder

Last updated 4 months ago