Sandbox: Lua: String - ov-studio/Vital.sandbox GitHub Wiki

━ What's the Objective?

Lua provides built in string module by default, however its deprived of utf8 support. utf8 is essential especially when trying to work w/ non ASCII characters such as 'cyrillic' etc. This module extends existing string module while adding utf8 support without breaking backwards compatibility!

━ APIs

ℹ️ Note:

Our extensions are written with backwards compatibility in mind; Expect your previous code to work as usual! However we recommend upgrading 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.encode() (Shared)

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

type: "tea", "aes128"
options: {
  string: key = encryptKey
}

━ string.decode() (Shared)

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

type: "tea", "aes128"
options: {
  string: key = encryptKey
}

━ 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
)