These are the built in methods for the Lgi scripting language:
string Strchr(str, ch[, len]);
Finds a unicode character in a string.
Arguments:
- str - the string to search in
- ch - the character to find
- [Optional] len - the maximum length in 'str' to search
Returns:
- The remainder of the string starting with the character found or NULL if not found.
string Strstr(str1, str2[, case_insensitive[, len]]);
Finds a string in another string.
Arguments:
- str1 - the string to search in
- str2 - the string to search for
- [Optional] case_insensitive - true if you want case sensitivity (default: false)
- [Optional] len - the maximum length in 'str' to search (default: the whole of 'str1')
Returns:
- The remainder of the string starting with the string found or NULL if not found.
int Strcmp(str1, str2[, case_insensitive[, len]]);
Compares 2 strings.
Arguments:
- str1 - the first string to compare
- str2 - the second string to compare
- [Optional] case_insensitive - true if you want case sensitivity (default: false)
- [Optional] len - the maximum length in characters to compare (default: the whole strings)
Returns:
- zero if the strings are the same, non-zero if they are not.
string Substr(str, start[, len]);
Returns a part of another string.
Arguments:
- str - the whole string
- start - the zero based character index of the sub string you want
- [Optional] len - the length of the substring (default: the rest of the string)
Returns:
Loads a string from the resource file.
Arguments:
Returns:
- A string or NULL on failure.
Formats a number of bytes in KB, MB or GB as appropriate.
Arguments:
- bytes - the size to format.
Returns:
- A string containing the size description.
string Sprintf(format[, args, ...]);
Formats a string.
Arguments:
- format - the format of the output string, same as C's printf.
- [optional]args - any arguments that are required to be formatted.
Returns:
list Tokenize(string, delimiter);
Splits a string up into segments according to the delimiter specified.
Arguments:
- string - the string to split.
- delimiter - the delimiter character, only the first character is used.
Returns:
- A list of strings, possibly empty.
Returns an empty hash table object.
Arguments:
Returns:
See also
this page on container
type handling.
Returns an empty list object.
Arguments:
Returns:
See also
this page on container
type handling.
Returns an empty list object.
Arguments:
- container - the list or hashtable container to delete from
- index - the index of the element, if 'container' is a list, then specify the
integer index of the element to delete. If it's a hash table, specific the
key of the element to delete as a string.
Returns:
- non-zero if successful, zero on error.
object New(object);
Creates a custom object.
Arguments:
- object - the name of the object.
Returns:
void Delete(object);
Deletes a custom object.
Arguments:
- object - the ptr of the object to delete.
Returns:
Returns the contents of a text file.
Arguments:
- filename - the name of the file
Returns:
- the contents of the file as a string.
Writes the contents of a variable to a text file.
Arguments:
- filename - the name of the file
- data - the date to write, can either be a string or a binary object
Returns:
- non-zero on succes, zero on failure.
list SelectFiles(parent_wnd[, file_types[, initial_dir[, multi_select]]]);
Shows a file select dialog.
Arguments:
- parent_wnd - the handle of the parent window.
- [optional] file_types - the types of files to select, e.g. "*.gif;*.png;*.jpg".
- [optional] initial_dir - the initial folder to select from.
- [optional] multi_select - TRUE if multiple file can be selected.
Returns:
list ListFiles(folder_path[, pattern]);
Lists files in a folder.
Arguments:
- folder_path - the folder to list.
- [optional] pattern - the files to list, e.g. "*.gif".
Returns:
Deletes a file.
Arguments:
- path - The path to the file to delete.
Returns:
- True if the file is deleted.
Pauses the current thread.
Arguments:
- ms - The number of milliseconds to pause for.
Returns:
Returns the current clock tick.
Arguments:
Returns:
- A 64bit clock time from an unknown epoch, in milliseconds. Useful for timing things.
int64 Now();
Returns the current date time.
Arguments:
Returns:
- A GDateTime variant set to the current date and time.
string Execute(executable, arguments);
Executes a process, waits for it to finish, and then returns the stdout as a string.
Arguments:
- executable - The path to the executable.
- arguments - Arguments to pass to the executable.
Returns:
- A string containing what the process wrote to stdout.
bool System(executable, arguments);
Executes a process and doesn't wait for it to finish.
Arguments:
- executable - The path to the executable.
- arguments - Arguments to pass to the executable.
Returns:
- A string containing what the process wrote to stdout.
string GetInputDlg(parent_wnd, initial_value, msg, title, is_password);
Asks the user for input using a dialog.
Arguments:
- parent_wnd - The handle of the parent window.
- initial_value - The initial value in the editbox field.
- msg - A message above the editbox.
- title - The title of the dialog.
- is_password - True if you want the editbox content obsured by dot characters.
Returns:
- A string containing what the user entered.