WriteFile

Write a string of data to a sandboxed .ssn file. Overwrites any existing contents.

Syntax

Susano.WriteFile(name, data) -> boolean

Parameters

name (string): The filename. Must be a plain name.ssn: no directories, no path separators, no traversal.

data (string): The bytes to write. Binary-safe; length is taken from the Lua string, so embedded \0 bytes are preserved.

Return(s)

boolean: true if the file was opened and written successfully, false if the file could not be created or the write failed.

Behavior

Validates name first: only single filenames matching the name.ssn pattern are accepted. Any attempt to pass a path, use .., or reference another extension raises a Lua error.

Opens the file for binary output and truncates its previous contents before writing. On failure to open, returns false without raising.

Example(s)

local ok = Susano.WriteFile("settings.ssn", '{"aimbot":true,"fov":30}')
if not ok then
    print("Failed to save settings")
end