Skip to content

Library: String

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

» What's the Objective?

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.

» How to Import?

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)

@Objective: Verifies whether the string is void.
local bool: result = string.isVoid(
  string: baseString
)

━ string.parse() (Shared)

@Objective: Parses and returns possible value out of the string.
local ~: result = string.parse(
  string: baseString
)

━ string.parseHex() (Shared)

@Objective: Parses and returns possible color values of the hex.
local float: r, float: g, float: b = string.parseHex(
  string: baseString
)

━ string.formatTime() (Shared)

@Objective: Formats milliseconds into hours:minutes:seconds time format.
local string: result = string.formatTime(
  number: milliseconds
)

━ string.encode() (Shared)

@Objective: Encodes the data using specified options.
ℹ️ For type and options refer
local string: result = string.encode(
  string: baseString,
  string: type,
  table: options
)

━ string.decode() (Shared)

@Objective: Decodes the encoded data using specified options.
ℹ️ For type and options refer
local string: result = string.decode(
  string: baseString,
  string: type,
  table: options
)

━ string.split() (Shared)

@Objective: Splits the data using specified separator.
local table: result = string.split(
  string: baseString
  string: separator
)

━ string.kern() (Shared)

@Objective: 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)

@Objective: Converts specified string's tabs to spaces.
local string: result = string.detab(
  string: baseString
)

━ string.minify() (Shared)

@Objective: Minifies the specified data.
local string: result = string.minify(
  string: baseString
)
Clone this wiki locally