Skip to content

Library: String

ᴏᴠ ━ ᴀɴɪꜱᴀ edited this page Dec 5, 2024 · 13 revisions

» Overview

The Lua standard library's string module lacks comprehensive UTF-8 support, which is crucial for handling non-ASCII characters like Cyrillic text. This module extends the existing string module with UTF-8 support while maintaining backward compatibility.

» Importing

It's already imported by default whenever you import assetify. You need to declare the below globally only once:

loadstring(exports.assetify_library:import())()

» APIs

ℹ️ Our extensions are designed with backward compatibility in mind; your existing code is expected to function as intended. Nonetheless, we recommend transitioning to newer syntax.

  • string.isVoid() - shared

    Verifies whether the string is void.

    local bool: result = string.isVoid(
       string: baseString
    )
  • string.parse() - shared

    Parses and returns possible values of the string.

    local ~: result = string.parse(
       string: baseString
    )
  • string.parseHex() - shared

    Parses and returns possible color values of the hex.

    local float: r, float: g, float: b = string.parseHex(
       string: baseString
    )
  • string.formatTime() - shared

    Formats milliseconds into hours:minutes:seconds time format.

    local string: result = string.formatTime(
       number: milliseconds
    )
  • string.encode() - shared

    Encodes the data using specified options.
    💡 For type and options refer here.

    local string: result = string.encode(
       string: baseString,
       string: type,
       table: options
    )
  • string.decode() - shared

    Decodes the encoded data using specified options.
    💡 For type and options refer here.

    local string: result = string.decode(
       string: baseString,
       string: type,
       table: options
    )
  • string.split() - shared

    Splits the data using specified separator.

    local table: result = string.split(
       string: baseString
       string: separator
    )
  • string.kern() - shared

    Kerns the data using specified kerner.

    local string: result = string.kern(
       string: baseString
       string: kerner --Optional: By default it use " " as kerner if left unspecified
    )
  • string.detab() - shared

    Converts specified string's tabs to spaces.

    local string: result = string.detab(
       string: baseString
    )
  • string.minify() - shared

    Minifies the specified data.

    local string: result = string.minify(
       string: baseString
    )