The math
library provides a number of useful math functions as well as special functions for Base64, and hashing and digests. More are added as needed. To make your own contributions, see the page Pico Engine welcoming your contributions for step-by-step guidance.
General Functions
absolute value
...
Code Block |
---|
math:round(4066.123,2) // 4066.12
math:round(4066.123,0) // 4066
math:round(4066.123,-2) // 4100 |
Base64 Functions
math:base64encode(str,
[encoding])
Given a utf8 string, str of type [encoding], return the base64 string string. If the encoding is omitted, it defaults to utf8.
Code Block |
---|
language | js |
---|
theme | Confluence |
---|
|
math:base64encode(payload,"hex") |
math:base64decode(str,[encoding])
Decode the given base64 string, str, return the utf8 stringstr returning a value with a type of [ encoding ] . If the encoding is omitted, it defaults to utf8.
Code Block |
---|
language | js |
---|
theme | Confluence |
---|
|
math:base64decode(payload,"hex") |
Hashing and Digest Functions
...