Appendix A. Global Functions
Global functions are those which exist in a global scope, meaning they can be called from anywhere inside of a Hassium program.
Here is a documented list of all the Hassium global functions, their syntax, and what they do.
class globals
func clone (obj : object) : object
@desc:
Creates a clone of the given object.
@param obj:
The object to clone.
@returns:
The cloned object.
func format (fmt : string, params obj) : string
@desc:
C# formats the given format string with a list of arguments.
@param fmt:
The format string.
@optional params obj:
The list of format arguments.
@returns:
The resulting formatted string.
func getattrib (obj : object, attrib : string) : object
@desc:
Gets the specified attribute from the given object by name.
@param obj:
The object containing the attributes.
@param attrib:
The name of the desired attribute
@returns:
The value of the attribute.
func getattribs (obj : object) : dict
@desc:
Gets a dict containing the attributes in { string : object } format of the given object.
@param obj:
The object to get attributes from.
@returns:
A dictionary with the attributes.
func getdocdesc (obj : object) : string
@desc:
Gets the @desc parameter of documentation for a function.
@param obj:
The function to get documentation for.
@returns:
The documentation description.
func getdocoptparams (obj : object) list
@desc:
Gets the @optional parameters of documentation for a function.
@param obj:
The function to get documentation for.
@returns:
A list of the documentation optional parameters.
func getdocreqparams (obj : object) : list
@desc:
Gets the @param parameters of documentation for a function.
@param obj:
The function to get documentation for.
@returns:
A list of the documentation parameters.
func getdocreturns (obj : object) : list
@desc:
Gets the @returns parameter of documentation for a function.
@param obj:
The function to get documentation for.
@returns:
The documentation returns.
func getparamlengths (obj : object) : list
@desc:
Gets a list of possible parameter lengths for the given function.
@param obj:
The function to get parameter lengths for.
@returns:
The parameter lengths.
func getsourcerep (obj : object) : string
@desc:
Gets the string source representation for the given function.
@param obj:
The function to get source representation for.
@returns:
The source representation.
func getsourcereps (obj : object) : list
@desc:
Gets a list of the possible source representations for the given function.
@param obj:
The function to get source representations for.
@returns:
The source representations.
func hasattrib (obj : object, attrib : string) : bool
@desc:
Returns a bool indicating if the given object contains the specified attribute.
@param obj:
The object whose attributes to check.
@param attrib:
The attribute name to chech.
@returns:
true if obj contains attrib, otherwise false.
func help (obj : object) : null
@desc:
Prints to stdout a helpdoc for the given function using the sourcerep and docs.
@param obj:
The function to get help for.
@returns:
null.
func input () : string
@desc:
Reads a line from stdin and returns it.
@returns:
The string line.
func map (l : list, f : func) : list
@desc:
Iterates over the given list, adding to a new list the result of invoking F() with each list element.
@param l:
The list of input values.
@param f:
The function to operate with.
@returns:
The new list of results.
func print (params obj) : null
@desc:
Writes the string value of the given objects to stdout.
@optional params obj:
List of objects to print.
@returns:
null.
func printf (strf : string, params obj) : null
@desc:
Writes the string value of the result of formatting the given format string with the given format args.
@param strf:
The format string.
@optional params obj:
The list of format arguments.
@returns:
null.
func println (params obj) : null
@desc:
Writes the string value of the given objects to stdout, each followed by a newline.
@optional params obj:
List of objects to print.
@returns:
null.
func range (upper : int) : list
func range (lower : int, upper : int) : list
@desc:
Returns a list of every number between 0 or a specified lower bound, and the specified upper bound.
@param upper:
The upper bound (non-inclusive).
@optional lower:
The lower bound (inclusive).
@returns:
The new list of values.
func setattrib (obj : object, attrib : string, val : object) : null
@desc:
Sets the value of specified attribute to the specified value in the given object.
@param obj:
The object whose attributes to modify.
@param attrib:
The name of the attribute to set.
@param val:
The value of the attribute to set.
@returns:
null.
func sleep (milliseconds : int) : null
@desc:
Stops the current thread for the specified number of milliseconds.
@param milliseconds:
The amount of milliseconds to sleep for.
@returns:
null.
func type (obj : object) : typedef
@desc:
Gets the typedef for the given object.
@param obj:
The object whose type to get.
@returns:
The typedef of the object.
func types (obj : object) : list
@desc:
Gets a list of typedefs for the given object.
@param obj:
The object whose types to get.
@returns:
The list of typedefs.