Debug¶
Standard RoStrap debugging library. Contains better error/warn functions and an implementation of TableToString
.
local Debug = Resources:LoadLibrary("Debug")
Library API¶
Debug.TableToString¶
string Debug.TableToString(table Table [, bool Multiline = false, string TableName])
Pretty self-explanatory. Table is the table to convert into a string. String TableName puts local TableName =
at the beginning. Multiline makes it multiline. Returns a string-readable version of Table.
Debug.DirectoryToString¶
string Debug.DirectoryToString(RbxObject Object)
A fixed version of GetFullName.
Debug.Inspect¶
string Debug.Inspect(any Object)
Returns a string representation of Object
Debug.EscapeString¶
string Debug.EscapeString(string String)
Turns strings into Lua-readable format. Returns Objects location in proper Lua format. Useful for when you are doing string-intensive coding. Those minus signs are so tricky!
Debug.AlphabeticalOrder¶
function Debug.AlphabeticalOrder(table Dictionary)
Iteration function that iterates over a dictionary in alphabetical order. Dictionary is that which will be iterated over in alphabetical order. Not case-sensitive.
Example
for Key, Value in next, Debug.AlphabeticalOrder{Apple = true, Noodles = 5, Soup = false} do print(Key, Value) end
Debug.Error¶
void Debug.Error(string ErrorMessage, ... strings argumentsToFormatIn)
Standard RoStrap Erroring system. Prefixing ErrorMessage with '!' makes it expect the [error origin script].Name
as first parameter in {...}
. Past the initial Error string, subsequent arguments get unpacked in a string.format of the error string. Assert falls back on Error. Error blames the latest item on the traceback as the cause of the error. Error makes it clear which Library and function are being misused.
Debug.Assert¶
Condition Debug.Assert(Variant Condition, ... strings TupleToSendToError)
Returns Condition or Debug.Error(...)
Debug.Warn¶
void Debug.Warn(string ErrorMessage, ... strings argumentsToFormatIn)
Functions the same as Debug.Error, but internally calls warn instead of error.
Debug.UnionIteratorFunctions¶
function Debug.UnionIteratorFunctions(functions ...)
Unions iterator functions in the order they are passed in, without duplicates from overlap.
for i, v in Debug.UnionIteratorFunctions(ipairs, pairs){1,2,3,4, a = 1, b = 2} do print(i, v) end