Gopher Lua Packages for Vikingo Engine
| Method | Description | Parameters | Returns |
|---|---|---|---|
md5 |
Computes MD5 hash of string | string |
string (hex) |
sha1 |
Computes SHA1 hash of string | string |
string (hex) |
sha256 |
Computes SHA256 hash of string | string |
string (hex) |
sha512 |
Computes SHA512 hash of string | string |
string (hex) |
xor |
Performs XOR operation between data and key | data, key (number/string/table) |
data (same type as input data) |
| Method | Description | Parameters | Returns |
|---|---|---|---|
hex_encode |
Encodes string to hex | string |
string (hex) |
hex_decode |
Decodes hex string | string (hex) |
string, error |
url_encode |
URL encodes string | string |
string (encoded) |
url_decode |
URL decodes string | string (encoded) |
string, error |
base64_encode |
Encodes string to base64 | string |
string (base64) |
base64_decode |
Decodes base64 string | string (base64) |
string, error |
puny_encode |
Encodes string to Punycode | string |
string, error |
puny_decode |
Decodes Punycode string | string (punycode) |
string, error |
| Method | Description | Parameters | Returns |
|---|---|---|---|
split |
Splits string by separator | string, separator |
table (array of strings) |
fields |
Splits string by whitespace | string |
table (array of strings) |
has_prefix |
Checks if string has prefix | string, prefix |
boolean |
has_suffix |
Checks if string has suffix | string, suffix |
boolean |
trim |
Removes characters from start and end | string, cutset |
string |
trim_space |
Removes whitespace from start and end | string |
string |
trim_prefix |
Removes prefix | string, prefix |
string |
trim_suffix |
Removes suffix | string, suffix |
string |
contains |
Checks if string contains substring | string, substring |
boolean |
replace |
Replaces substrings | string, old, new, n |
string |
| Method | Description | Parameters | Returns |
|---|---|---|---|
compress |
Compresses data using zlib | string |
string (compressed data) |
decompress |
Decompresses zlib data | string (compressed data) |
string, error |
- All packages are loaded through the
Preload()function inpreload.go - Methods are available in Lua as modules:
crypto.md5(),encoding.hex_encode(),strings.split(),zlib.compress() - Decoding methods return two values: result and error (if any)
- Encoding methods return only the result