Utility

convertStringToLower

function convertStringToLower(string)

Converts the specified string into lower case.

Parameters

string (string)   
A string to edit

Return values

(string)
Returns the lower case version of the string

convertStringToUpper

function convertStringToUpper(string)

Converts the specified string into upper case.

Parameters

string (string)   
A string to edit

Return values

(string)
Returns the upper case version of the string

decodeCSV

function decodeCSV(xmlstring)

Converts the specified CSV string into an internal Lua table format for XML.

NOTE: The internal table format is not specifically documented. Use Debug package to output examples to learn the format.

Parameters

xmlstring (string)   
A string representation of an CSV document

Return values

(table)
An internal Lua table format for XML

decodeJSON

Converts the specified JSON string into an internal Lua table format for XML. If the parsing of the JSON string fails for any reason, a nil value will be returned.

NOTE: The internal table format is not specifically documented. Use Debug package to output examples to learn the format.

Parameters

xmlstring (string)   
A string representation of an JSON document

Return values

(table)
An internal Lua table format for XML

decodeURL

Converts a URL-encoded string into a string without URL encoding.

Parameters

urlstring (string)   
A string containing an encoded URL

Return values

(string)
A version of string parameter with URL encoding removed

decodeXML

Converts the specified XML string into an internal Lua table format for XML.

NOTE: The internal table format is not specifically documented. Use Debug package to output examples to learn the format.

Parameters

xmlstring (string)   
A string representation of an XML document

Return values

(table)
An internal Lua table format for XML

encodeCSV

Converts the internal Lua table format for CSV into an CSV string.

NOTE: The internal table format is not specifically documented. Use Debug package to output examples to learn the format.

Parameters

xmltable (table)   
An internal Lua table format for CSV

Return values

(string)
A string representation of a CSV document.

encodeJSON

Converts the internal Lua table format for JSON into a JSON string. If the encoding of the JSON fails for any reason, a nil value will be returned.

NOTE: The internal table format is not specifically documented. Use Debug package to output examples to learn the format.

Parameters

xmltable (table)   
An internal Lua table format for JSON

Return values

(string)
A string representation of a JSON document.

encodeURL

Converts a standard string into a URL-encoded string.

Parameters

string (string)   
A string containing a URL that needs to be encoded

Return values

(string)
A version of string parameter with URL encoding

encodeXML

Converts the internal Lua table format for XML into an XML string.

NOTE: The internal table format is not specifically documented. Use Debug package to output examples to learn the format.

Parameters

xmltable (table)   
An internal Lua table format for XML

Return values

(string)
An XML string representation of an XML document.

getDiceTotal

Calculates the total value of the dice data table passed to this function. See dragdata.getDiceData for details of the dice data. If the individual dice list is missing, then it will be rebuilt from the dice expression key (“expr”). If the dice expression is missing, then it will be rebuilt as the addition of the individual dice.

Parameters

dicedata (table)   
An integer indexed table of strings listing the dice expression and total, as well as the details of the individual dice to be used in the dice expression.

Return values

(number)
The calculated total of the dice data table, per the dice expression and dice values