Skip to content

Feature: String

Tron edited this page Jan 13, 2023 · 1 revision

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

━ How to Import?

It gets imported automatically by default whenever you initialize assetify.

--Declare it globally only once
loadstring(exports.assetify_library:import())()

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