Skip to content

Latest commit

 

History

History
80 lines (68 loc) · 5.27 KB

File metadata and controls

80 lines (68 loc) · 5.27 KB

Current

v 0.9

Requires

conversion.lua

Syntax

Load module

-- module = require "ModuleName"
local ct = require "CommonTools"

-- For nested module (like "StringOr")
-- load nested module only
local strOr = (require "CommonTools").StringOr

Function call

-- module:FunctionName()
local tFRec = ct:GetFilesRecursive(ct:GetCurrentDir(), "lua", "hs")

-- for nested module
-- direct call
local s, e = ct.StringOr:find("foobar", {"o","b"})

-- or assign the sub module
local strOr = ct.StringOr
local s, e = strOr:find("foobar", {"o","b"})

Content

SYSTEM
CommandlineReadRuns a command in the Windows shell and saves the result rows in a table
FileExistsChecks if a file exists
FolderCreateCreates a folder (if not exists)
FolderExistsChecks if a folder exists
GetCurrentDirReturns the script directory
GetFilesRecursiveReturns a table with all recursive files (full path name) from given root. You can use filter for file type and attributes.
GetFolderRecursiveReturns a table with all recursive sub folders (full path name) from given root. You can use filter for attributes.
OSNowReturns a table with date & time fields from now
OSDateReturns a string with the current date as "YYYY-MM-DD"
OSTimeReturns a string with the current time as "hh:mm:ss"
require_protectedLoad library protected
No longer usable due to the use of Lua 5.3 in SciTE
EDITOR
EditorCodingCookieLineChecks the current buffer for coding cookie. Returns the line number from this or nil.
EditorDeleteLineDeletes the passed line number from editor. Returns line content if success.
EditorGetCommentCharReturns the character(s) for a line comment of the passed file type (or default: from current buffer), if defined.
EditorGetEOLReturns length, mode of EOL and the EOL character(s) in current SciTE buffer
EditorMoveLineMoves a line in editor up/down by param count (negative=up/positive=down).
EditorTabColPosInLineReturns column and position of previous/next TAB in passed line
EditorTabReplaceReplaces all TAB in the file currently open in SciTE with spaces
MISC
ASCIIcompareComparison of two ASCII strings, optionally case-insensitive (default: case-sensitive). Return of both strings in sorted order.
EscapeMagicEscapes all magic characters in a string: ( ) . % + - * ? [ ^ $
InSensePatternCreates an insensitive pattern string ("Hallo" --> "[Hh][Aa][Ll][Ll][Oo]"). Ascii chars only!
LineTabReplaceReplaces TAB in a line with the number of spaces corresponding to the column.
Power2AndChecks if a passed uint value contains a given power of 2.
PropExtAsks for property specified by filter.extension or extension
SplitSplits a string by the passed delimiter into a table (each character as one element only with ASCII characters)
StringOrA nested module with string functions: .find / .gmatch / .gsub / .match
Lua patterns do not support alternations. Therefore, these functions can be called here with a list of patterns applied to the string. The pattern works: "patt1 or patt2 or patt_n"
StringOr.findReturns start/end of the first occurence of the first matching pattern.
StringOr.gmatchReturns a table with all occurences of each matching pattern.
StringOr.gsubReturns a string in which all (or _n) occurrences of each matching pattern are replaced.
StringOr.matchReturns the first occurence of the first matching pattern.
StripSpaceCharStrip space characters (%s) from a string.
StringUTF8LenGet the number of characters (not the number of bytes, like string.len) of a string with UTF8 characters
StringUTF8SplitSplits a string by the passed delimiter into a table (each character as one element with UTF8 characters too)
TernaryThe ternary operator as function (condition, if_true, if_false)
TrimTrim a count of chars from a strings left or right side
Optionally also remove remaining spaces
UrlEncodeReturns the given string encoded for use in URL
AU3 - SPECIFIC
GetIncludePathesReturns a table with locations of AU3 - include files in the system