filepath

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

README

filepath GoDoc

Lua module for path/filepath.

Usage

local filepath = require("filepath")

-- filepath.ext()
local result = filepath.ext("/var/tmp/file.name")
if not(result == ".name") then error("ext") end

-- filepath.basename()
local result = filepath.basename("/var/tmp/file.name")
if not(result == "file.name") then error("basename") end

-- filepath.dir()
local result = filepath.dir("/var/tmp/file.name")
if not(result == "/var/tmp") then error("dir") end

-- filepath.join()
local result = filepath.join("/var", "tmp", "file.name")
if not(result == "/var/tmp/file.name") then error("join") end

-- filepath.glob()
local result = filepath.glob("/var/*/*.name")
if not(result[1] == "/var/tmp/file.name") then error("glob") end

Documentation

Overview

Package filepath implements golang filepath functionality for lua.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Basename

func Basename(L *lua.LState) int

Basename lua filepath.basename(path) returns the last element of path

func Dir

func Dir(L *lua.LState) int

Dir lua filepath.dir(path) returns all but the last element of path, typically the path's directory

func Ext

func Ext(L *lua.LState) int

Ext lua filepath.ext(path) returns the file name extension used by path.

func Glob

func Glob(L *lua.LState) int

filepath.glob(pattern) returns the names of all files matching pattern or nil if there is no matching file.

func Join

func Join(L *lua.LState) int

Join lua fileapth.join(path, ...) joins any number of path elements into a single path, adding a Separator if necessary.

func ListSeparator

func ListSeparator(L *lua.LState) int

ListSeparator lua filepath.list_separator() OS-specific path list separator

func Loader

func Loader(L *lua.LState) int

Loader is the module loader function.

func Preload

func Preload(L *lua.LState)

Preload adds filepath to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:

local filepath = require("filepath")

func Separator

func Separator(L *lua.LState) int

Separator lua filepath.separator() OS-specific path separator

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL