Skip to content

Releases: TypesettingTools/Functional

Functional v0.6.0

12 Mar 00:27
Compare
Choose a tag to compare

Changes

  • list.find and list.findInRange now return the index of the found item in the list as a second return value (thanks @Myaamori)
  • string.split: now takes an additional limit parameter to specify the maximum number of split operations (thanks @Myaamori)"

Fixes

  • util.assTimecode2ms: fixed a null-reference exception due to local tonumber reference being reassigned to nil (thanks @Myaamori)

Functional v0.5.0

12 Mar 00:24
Compare
Choose a tag to compare

New Functions

  • list.reverse: creates a copy of a numerically keyed table with its elements in the reverse order.
  • unicode.reverse: reverses an UTF-8 string.
  • util.assTimecode2ms and util.ms2AssTimecode: convert between ASS timecodes and milliseconds.
  • util.getScriptInfo: takes an Aegisub subtitle object and extracts all key-value pairs from the Script Info block as a hash-mapped table
  • table comparison:
  • string.trim, string.trimLeft and string.trimRight: trim leading and/or trailing whitespace from strings

Changes

  • list.makeSet now takes an additional parameter to override the default value of true for all set items
  • string.formatEx got some error handling that catches string.format exeptions an returns an helpful error message using lua multi-return conventions

Fixes

  • table.keys: fixed bad nil type comparison for except parameter
  • table.diff: fixed typo that caused the left table to be compared with itself
  • string.formatEx: fixed replacements not being made due to missing return statement
  • re.matches and re.sub: fixed bad references to unicode.toCharTable

Functional v0.4.0

14 Jul 00:23
Compare
Choose a tag to compare
Functional v0.4.0 Pre-release
Pre-release

New Functions

  • unicode.sub: gets a substring of a unicode string, where the start and end indices refer to unicode characters/code points instead of bytes.
  • table.removeKeysExcept: a special case of table.removeKeys which removes anything but the specified table keys.
  • table.pluck: takes any table values in a table, then for every of those tables extracts the value at the specified key, and finally returns a list of all extracted values.
  • table.continuous: takes the values at any numerical key in the specified table and compiles them all in a continuous list (in numerical order).
  • table comparison:
    • list.compare and list.compareLeft: compares two lists using a user-supplied iteratee function, with compare reading until then end of the longer list and compareLeft only reading to then end of the first list.
    • table.compare and table.compareLeft: a more generic (and slower) version of the list equivalent, which supports arbitrary table keys
  • math.roundMany: works just like math.round but takes additional numbers to round as varargs and returns as many values.
  • util.uuid: creates a pseudo-random uuidv4.
  • util.RGB_to_HSV: converts an RGB color into HSV representation.
  • math.seedRNG: seeds the RNG either automatically and exactly once (no matter how often the method is called) using the system time or, alternatively, using a custom seed.

Changes

  • re.replace now also takes precompiled patterns as an input
  • table.merge now returns the target table as the first value and no longer overwrites false values.
  • list.removeIndexes had its signature changed to list.removeIndices and now takes a table of indices instead of the previous varargs.
  • math.round now returns the supplied number as-is when rounding to infinite digits.

Fixes

  • fixed a few linter suggestions

Functional v0.3.0

24 Jan 12:34
Compare
Choose a tag to compare
Functional v0.3.0 Pre-release
Pre-release

New Functions

  • 2D vector math:
    • math.vector2.distance: returns the distance between 2 points or the length of a 2D vector.
    • math.vector2.normalize: scales the length of a vector to 1 or a user-specified length.
  • math.degrees: converts radians to degrees.
  • list.groupBy: creates a table composed of keys generated from the results of applying the specified selector (a callback or property name) to each list element, with the value being a list of all elements generating the same key.

Changes

  • table.values now allows for specifying an optional sorting function to run on the generated list.

Functional v0.2.0

02 Jan 17:34
Compare
Choose a tag to compare
Functional v0.2.0 Pre-release
Pre-release

New Functions

  • string.pad: pads a string with repetitions of another string up to a defined character limit. Pads with zeros by default.
  • util.formatTimecode: formats a time in milliseconds according to a .NET-like format string, e.g. h:mm:ss.fffor ASS time codes.

Changes/Fixes

  • list.removeWhere now defaults to shifting up fields to keep the list continuous. A parameter was added to switch to sparse mode.

Functional v0.1.0 (initial release)

22 Nov 14:49
Compare
Choose a tag to compare
Pre-release

Requires not-yet-released DependencyControl w/ Unit Test Suite to work.
Documentation forthcoming...