isfile Synchronous

Ask whether a workspace path names an existing file. It is a quick way to make optional data truly optional before calling readfile.

Syntax
Luau
isfile(path: string) -> boolean

Parameters

Function parameters
ParameterTypeDescription
pathstringWorkspace-relative path to check.

Returns

boolean

true for an accessible file; false otherwise.

Usage notes

A folder is not a file. false is not a detailed diagnostic for why a path cannot be opened.

Differences from Volt

Volt documents access through explicitly created workspace symlinks. Kawaii rejects symlinks in workspace paths; all workspace operations remain subject to its path containment checks.

Example

Example
Luau
local path = "settings.json"
if isfile(path) then
    print("Loaded", #readfile(path), "bytes")
end
Kawaii documentation