Libraries - Xeptix/framework GitHub Wiki

Framework Libraries

Libraries are global variables such as math, table, etc that lua provides for you to allow you to manipulate a certain value type. The framework adds many new feature to these.

* optional argument

string

The string library allows you to manipulate strings. These are the additional api the framework provides.

coming soon

coming soon

math

The math library allows you to manipulate numbers. These are the additional api the framework provides.

coming soon

coming soon

table

The table library allows you to manipulate tables. These are the additional api the framework provides.

table.join

<string> table.join(<table>, <string>)

Combines all the values of <table> into a string. Each value is separated by <string>

Example:

print(table.join({"hello world", "how", "are", "you"}, ", ")) --> hello world, how, are, you?

table.format

<string> table.format(<table>, <string>, <*string[2]>)

Formats <table> into a string, with a custom format (<string>), optionally separated by <*string[2]>

When formatting with <string>, %i is replaced with the index, and %v is replaced with the value.

Example:

print(table.format({test = 1337, hello = "world", how = "are you?"}, "%i=%v", "&")) --> test=1337&hello=world&how=are you?

table.recursive

<void> table.recursive(<table>, <function>)

Recursively loops through <table>, calling <function> with each value.

<function> is called with the following arguments: <table> table, <mixed> index, <mixed> value

Example:

local example = {
    a = 1337,
    b = {
        c = 420
    }
}

table.recursive(example, function(t, i, v)
    print(t, i, v)
end)

Output:

table: 48B1F688 a 1337
table: 48B1F688 b table: 48B24908
table: 48B24908 c 420
⚠️ **GitHub.com Fallback** ⚠️