[edit] Globals and Addons
These are a bunch of items added to LuaVerge. Some of which are for internal use, others are just handy, and not worth shoving in the vx package. At any rate, I document that stuff here.
[edit] Globals
print(...)
- Overrides Lua's built-in print mechanism so that output will be redirected to v3.log instead of stdout. It should work pretty identical other than that small change. It's actually an alias for
vx.Log.
FileExists(filename) -> boolean
- Checks to see if a file by a given name exists. Mostly unnecessary at this point.
bool(v) -> boolean
- Coerces any value into a boolean, by going "not not v".
num(v) -> number
- Coerces any value into a number, like
tonumber, except that it returns 0 if that fails.
[edit] String Library Addons
string.startsWith(s, substr) -> boolean
s:startsWith(substr) -> boolean
- Returns whether or not a string starts with a certain substring.
string.endsWith(s, substr) -> boolean
s:endsWith(substr) -> boolean
- Returns whether or not a string ends with a certain substring.
string.TokenCount(s, delim) -> number
s:TokenCount(delim) -> number
- Returns the number of tokens that this string can be split into, using delim as a set of characters that separates each piece of the string.
string.GetToken(s, delim, index) -> string
s:GetToken(delim, n) -> string
- Returns the n-th token within the string using delim as a set of characters that separates each piece of the string.
[edit] Table Library Addons
table.flatten(s[, t]) -> table
- Returns a flattened version of nested array-style tables. So {1, 2, {3, 4}} becomes {1, 2, 3, 4}.
table.reverse(t) -> table
- Returns a reversed copy of the table it's passed. So {1, 2, 3} becomes {3, 2, 1}.