Skip to content

GrangerHub/granger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Granger

AppVeyor Travis-CI

Lua API documentation

os.access(p, mode)
Checks that the file is executable/writable/readable. mode is a string of the characters "rwx".

os.chdir(p)
Change the current working directory.

os.copyfile(src, dst)
Copy a file from one location to another.

os.elevate()
Attempts to re-run process under elevated privlidges, returning true if elevated or false if unsuccessful.

os.get()
Retrieve the current operating system ID string.

os.getcwd()
Retrieve the current working directory.

os.is(id)
Check the current operating system.

os.is64bit()
Determine if the current system is running a 64-bit architecture.

os.isdir(p)
Returns true if the specified directory exists.

os.isfile(p)
Returns true if the given file exists.

os.matchdirs(p)
Performs a wildcard match to locate one or more directories.

os.matchfiles(p)
Performs a wildcard match to locate one or more files.

os.mkdir(p)
An overload of os.mkdir() function, which will create any missing subdirectories along the path.

os.outputof(cmd)
Run a shell command and return the output.

os.pathsearch(p, path1, ...)
Locates a file, given a set of search paths.

os.rmdir(p)
Remove a directory, along with any contained files or subdirectories.

os.stat(p)
Retrieve information about a file.

path.getbasename(p)
Retrieve the filename portion of a path, without any extension.

path.getabsolute(p)
Returns an absolute version of a relative path.

path.getdirectory(p)
Retrieve the directory portion of a path, or an empty string if the path does not include a directory.

path.getdrive(p)
Retrieve the drive letter, if a Windows path.

path.getextension(p)
Retrieve the file extension.

path.getname(p)
Retreive the filename portion of a path.

path.getrelative(p1, p2)
Returns a path relative to another.

path.isabsolute(p)
Determines if a path is absolute or relative.

path.join(...)
Builds a path from two or more path parts.

path.normalize(p)
Removes any wwirdness from a file system path string.

path.rebase(p, oldbase, newbase)
Takes a path which is relative to one location and makes it relative to another location instead.

path.translate(p, sep)
Convert the separators in a path from one form to another. If sep is nil, then a platform-specific separator is used.

path.wildcards(pattern)
Converts from a simple wildcard syntax, where * is "match any" and ** is "match recursive", to the corresponding Lua pattern.

string.explode(s, pattern, plain)
Returns an array of strings, each which is a substring of s formed by splitting on boundaries formed by pattern.

string.endswith(haystack, needle)
Returns true if haystack ends with needle.

string.findlast(s, pattern, plain)
Find the last instance of a pattern in a string.

string.startswith(haystack, needle)
Returns true if haystack starts with needle.

table.contains(t, value)
Returns true if the table contains the specified value.

table.extract(arr, fname)
Enumerates an array of objects and returns a new table containing only the value of one particular field.

table.flatten(arr)
Flattens a hierarchy of tables into a single array containing all of the values.

table.implode(arr, before, after, between)
Merges an array of items into a string.

table.insertflat(tbl, values)
Inserts a value of array of values into a table. If the value is itself a table, its contents are enumerated and added instead. So these inputs give these outputs:
"x" -> { "x" }
{ "x", "y" } -> { "x", "y" }
{ "x", { "y" }} -> { "x", "y" }

table.isempty(t)
Returns true of the table is empty, and contains no indexed or keyed values.

table.join(...)
Adds the values from one array to the end of another and returns the result.

table.keys(tbl)
Return a list of all the keys used in a table.

table.merge(...)
Adds the key-value associations from one table into another and returns the resulting merged table.

table.translate(arr, translation)
Translates the values contained in array, using specified translation table and returns the results in a new array.

Releases

No releases published

Packages

No packages published