Mach Modules Documentation
Lua Module API Documentation
Loading...
Searching...
No Matches
Path.lua File Reference

Go to the source code of this file.

Functions

Path SplitPath (path)
 Split a path string into its component parts: parent directory, filename, and extension.
Path BaseName (path)
 Return the base name of a file path with no directory component and no file extension.
Path Absolute (path)
Path Absolute (path, base_path)
Path GetEscapedPath (path)
Path GetParent (path)
Path GetFileName (path)
Path GetBaseName (path)
Path Join (...)
Path FileExists (path)
Path DirectoryExists (path)
Path MoveFile (source, target)
Path CreateDirectories (path)
Path RemoveDirectories (path)
Path RemoveFile (path)

Function Documentation

◆ Absolute() [1/2]

Path Absolute ( path )

◆ Absolute() [2/2]

Path Absolute ( path ,
base_path  )

◆ BaseName()

Path BaseName ( path )

Return the base name of a file path with no directory component and no file extension.

Uses Path.SplitPath() to decompose the path, then strips the extension from the filename component. If the file has no extension, the filename is returned as-is.

Parameters
path(string) Full or relative path from which to extract the base name
Returns
(string) The file name with no directory path and no extension
Note
Documentation generated by AI on 2026-03-03

◆ CreateDirectories()

Path CreateDirectories ( path )

◆ DirectoryExists()

Path DirectoryExists ( path )

◆ FileExists()

Path FileExists ( path )

◆ GetBaseName()

Path GetBaseName ( path )

◆ GetEscapedPath()

Path GetEscapedPath ( path )

◆ GetFileName()

Path GetFileName ( path )

◆ GetParent()

Path GetParent ( path )

◆ Join()

Path Join ( ...)

◆ MoveFile()

Path MoveFile ( source ,
target  )

◆ RemoveDirectories()

Path RemoveDirectories ( path )

◆ RemoveFile()

Path RemoveFile ( path )

◆ SplitPath()

Path SplitPath ( path )

Split a path string into its component parts: parent directory, filename, and extension.

Decomposes a filesystem path into three components using pattern matching that handles both forward slash and backslash directory separators. The parent path will end with a directory separator. If the file has no extension, the extension component will equal the filename component.

Parameters
path(string) The filesystem path to split
Returns
(table) A three-element array: {parent_path (string), filename (string), extension (string)}
-- Get the base name (filename including extension, no directory):
local filename = Path.SplitPath(my_path)[2]
-- Get the parent directory:
local dirname = Path.SplitPath(my_path)[1]
-- Get the grandparent directory:
local grandparent = Path.SplitPath(Path.SplitPath(my_path)[1]:sub(1,-2))[1]
GUIModule Notebooks Get()
Retrieve a notebook object by name from the Notebooks collection.
Path SplitPath(path)
Split a path string into its component parts: parent directory, filename, and extension.
name("m3")
Handle M3 plasma cutting start failure by reporting an alarm or error based on machine state.
Note
Documentation generated by AI on 2026-03-03