Skip to main content
Numeric and text functions. Each row maps one concept from Lipi to the other languages; the word in a cell is the relation, explained in the language map overview. Each section below gives the Lipi construct first, then the construct in each language, with a note wherever behaviour differs. The language name links to the documentation the row was checked against.

Absolute value

The absolute value of number: its magnitude, with the sign removed. In Lipi: math.abs.

Rounding

Rounds number to the nearest whole number and returns an int. In Lipi: math.round, math.ceil, math.floor.

Round to the tick size

Rounds number to the nearest multiple of syminfo.mintick for the chart symbol. In Lipi: math.round_to_mintick.

Smaller or larger of values

The smallest of the numbers you pass. In Lipi: math.min, math.max.

Powers and roots

base raised to the power of exponent. In Lipi: math.pow, math.sqrt.

Exponent and logarithms

Euler’s number raised to the power of number. In Lipi: math.exp, math.log, math.log10.

Trigonometry

The sine of angle, where the angle is in radians. In Lipi: math.sin, math.cos, math.tan, math.asin, math.acos, math.atan.

Degrees and radians

Converts an angle in radians to the same angle in degrees. In Lipi: math.todegrees, math.toradians.

Sign of a number

The sign of number: -1 for a negative number and 1 for a positive one. In Lipi: math.sign.

Random number

Gives your script a random float, bounded below by min and above by max. In Lipi: math.random.

Average and sum of values

The arithmetic mean of the numbers you pass: their sum divided by how many there are. In Lipi: math.avg, math.sum.

Number to text

Renders a value as a string. In Lipi: str.tostring.

Text to number

Reads a number out of a string. In Lipi: str.tonumber.

Length of text

Gives the length of a string as an int. In Lipi: str.length.

Upper and lower case

Converts a string to upper case; the other half of the pair with str.lower. In Lipi: str.upper, str.lower. Tests whether one string occurs inside another. In Lipi: str.contains, str.pos, str.startswith, str.endswith.

Part of a text

Cuts a piece out of a string. In Lipi: str.substring.

Replace text

Substitutes one piece of text for another inside a string. In Lipi: str.replace, str.replace_all.

Split text

Splits string wherever separator occurs and returns the pieces as an array of strings. In Lipi: str.split.

Trim spaces

Removes whitespace from around a string and hands back the result. In Lipi: str.trim.

Repeat text

Produces a string made of repeated copies of another, with the option of something between the copies. In Lipi: str.repeat.

Match a pattern

Returns the first part of source that matches the regular expression pattern. In Lipi: str.match.

Join texts

Joining two pieces of text into one. In Lipi: +.