The Combined Library is comprised of about 55 functions all of which are released under CC-by v3.0 license.

The library is still being worked on so only some of the compiled functions will be posted at this time. All functions in the library are hand optimized. To understand the logic, it is best to pull the code apart but be wary of LSL's strict order of operations.

String Functions

Replace

The originally posted function was largely superseded by this version posted below by Haravikk Mistral, it is much faster (under both LSL and Mono) while having identical behaviour, and in the majority of usages is more memory efficient:

Here is the original version of the function, while slower it is more memory efficient in LSO when the input string requires a large number of parts to be replaced. For example when replacing every space in a paragraph with an underscore. In LSO the cost of dividing the string into a list balloons the size of the string considerably.

Unescape

This is not the version found in Combined Library, it does not support the \h, \u or \U escape codes which are supported by the library version. Both support these escape codes: \\, \", \n, \t, \s

Like Haravikk'sReplace function, this has the potential to use a huge amount of memory, consider using the library version instead if memory usage becomes a problem. If you do not need the extra features and do not have memory limitations this is a great alternative.

Unicode functions

LSL uses UTF-8 to as the base format for strings. UTF-8 is an encoding system for storing Unicode characters, each Unicode character has a number. These functions allow for the conversion between the string form and the integer form. They may not be pretty but they are tight and get the job done quickly.

List Functions

Replace

The design of the logic had to overcome two hurdles. The first was keeping it from searching previous replacements (otherwise you could fall into an infinite loop or infinitely grow the memory). The second was so that it could do null replacements. Both of these hurdles were overcome but at the cost of some readability.

The way it works is it keeps an Unsearched Buffer (UB) which is a subset of the Input Buffer (IB) and it records the Position of the UB in the IB (P). Each iteration it searches the UB and adds that resulting index to the P, then it uses P as the index to replace that section in the IB, finally it recalculates the new P, then is uses IB with the new P to update UB.

Compare

Compares two lists, returns true if identical.

Note: It will ignore the sign on zero (0.0 == -0.0). If the sign on zero is important to you, follow the instructions in the comments on how to enable checking for this. Currently no functions in LSL treat negative zero differently then positive zero.

Global Buffers

These versions of the functions depend upon global buffers. Not all the functions have been ported to this model (because it is very complicated to build functions with macros so they can be flipped from one mode to the other).