lib_tools function library

Dependencies: lib_2da, lib_anon, lib_array, lib_fn, lib_ini, lib_sfo, lib_struct, lib_sugar

Description

Functions here do simple, IE-independent tasks. (If they're pure functions without side effects they should be in lib_fn instead.) No special naming conventions. (Be cautious!)

Functions here should have no dependencies outside lib_tools.

Functions

GET_UNIQUE_FILE_NAME(extension:s, base:s)=(filename:s) patch

A temporary fix for the WEIDU version, until Wisp fixes it.

append(arguments:s)=() patch
append(no_log:i, arguments:s, file:s, location:s, locbase:s, path:s)=() action

Append the string 'arguments' at the end of the file 'file' at locations given by location/locbase/path (or, in patch context, at the end of the current file), with no spacing or line breaks

data_lines(data:s, path:s, file:s)=(lines:a) dimorphic

Given either 'data' (a string) or a path to a file, return either the string or the file separated into an array of lines, separated by line-breaks.

find_parenthesis_range(left:s="{", right:s="}", index:s=0)=(start:s, end:s) patch

given an index in a file, a left string, and a right string, extract the index number of the left string and the matching right string

new_file(no_log:i, arguments:s, file:s, location:s, locbase:s, path:s)=() action

Create a new file 'file' at locations given by location/locbase/path, containing only the string 'arguments' with no spacing or line breaks

read_whatever(length:i, offset:i)=(value:s) patch

Given an offset in the current file, and given a length that is 1,2,or 4, read the appropriate-length integer from that offset.

write_whatever(length:i, write:i, offset:i)=() patch

Given an offset in the current file, a length that is 1,2,or 4, and an integer, write the integer to an appropriate-length slot at that offset.