[ Home ]

Library Documentation (v 0.12.1)

Data

Reading in textfiles and CSV files.
Data.loadtext(textfile:String):Array
Loads in a .txt file from data/text/ as an array of Strings, split by newlines. The files needs to have the extension .txt.
Data.loadjson(jsonfile:String):Dynamic
Loads in a .json file from data/text/ as a dynamic object. The file needs to have the extension .json. See Json and Xml parsing examples for more info.
Data.loadxml(xmlfile:String):Dynamic
Loads in a .xml file from data/text/ as a dynamic object. The file needs to have the extension .xml. See Json and Xml parsing examples for more info.
Data.loadcsv(csvfile:String, delimiter = ","):Array<???>
Loads in a .csv file from data/text/ as an array of values.
Data.load2dcsv(csvfile:String, delimiter = ","):Array<?>
Loads in a two-dimensional .csv file from data/text/ as a 2d array of values. Use Data.width and Data.height to read the width and height of the loaded 2d CSV.
Data.create2darray(width:Int, height:Int, defaultvalue:?):Array?>>
A helper function to give you a 2D array of given width and height, set to a default value that you choose.
Data.width:Int
After calling Data.load2dcsv(), Data.width will contain the width of the loaded array.
Data.height:Int
After calling Data.load2dcsv(), Data.height will contain the height of the loaded array.