Main
Updated for version 4.0 Utilities are useful functions for bunch of purposes.
BeardLib.Utils class
The main utilities class
Functions
Get
Function | Return Type | Description |
---|---|---|
CheckParamsValidity(Table tbl, Table schema) | Boolean | Checks |
CheckParamValidity(String func_name, Number vari, Any var, String desired_type, Boolean allow_nil) | Boolean | The function |
GetSubValues(Table tbl, String key) | Table | Returns a table of sub values that correspond to the key |
normalize_string_value(String value) | Any | Returns the object value from a string representation of the value. For example: "Vector3(0,0,0)" will return a vector3 object. This function supports: Vector3, Rotation, Color and callback, ClassClbk, SimpleClbk, etc |
StringToValue(String str, Table global_tbl, Boolean silent) | Any | Returns a value from a string. |
UrlEncode(String str) | String | Returns a string version of the passed str which is encoded for urls |
FindMod(String name) | ModCore | Searches a mod (All mods including these not in frameworks) with the name |
ModExists(String name) | Boolean | Returns a boolean determining if the mod exists in the game |
ModLoaded(String name) | Boolean | Returns a boolean determining if the mod exists and is loaded (not disabled) |
FindModWithPath(String path) | ModCore | Returns a mod in |
FindModWithMatchingPath(String path) | ModCore | Returns a mod with a path that matches |
Other
Function | Description |
---|---|
RefreshCurrentNode() | Refreshes the current menu node |
SetupXAudio() | A quick function to automatically setup BLT's XAudio stuff. Automatically called by BeardLib when adding sounds |
json class
Existing class added by BLT. BeardLib adds a special encoding and decoding function that add support for these values: Vector3, Color, Rotation, and callback.
This class uses periods and not a colon for function calls; so you'd call it like: json.func().
Functions
Function | Description |
---|---|
custom_encode | This is a variation of the default json encoder that comes bundled with BLT. This version of the encoder will output with proper formatting and can write data such as |
custom_decode | Similar to the custom_encode function, it is a variation of the default json decoder that comes bundled with BLT. This decoder will parse |
Anonymous functions
Functions
Function | Return type | Description |
---|---|---|
NotNil(...) | Any | Checks every value in parameters and returns the first value it finds that isn't null. Returns the null if no value was found. Useful when you want to differentiate between false and null |
type_name(Any value) | String | The same as CoreClass.type_name which returns the type of an object. But, adds support for tables that have |
CRC32Hash(String str) | Creates a CRC32 hash of a string. Good if you need something shorter than a Idstring key |
Examples
CheckParamsValidity
This function checks if x
is a string and not null (allow_nil defaults to false but for this example I wrote it) and checks if y
is a number but allows it to be a null.
GetSubValues
Returns:
Last updated