Skip to content

Commit

Permalink
3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Jun 28, 2020
1 parent 8114190 commit 09e1d07
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1 align="center">SNAP: Struct N' Array Parsing 3.2.0</h1>
<h1 align="center">SNAP: Struct N' Array Parsing 3.3.0</h1>

<p align="center">Easy struct/array saving and loading</p>

Expand All @@ -11,10 +11,11 @@ Functions included can:
1. Iterate over all elements of a struct/array and execute a function: `foreach()`
2. Make a deep copy of a struct/array: `snap_deep_copy(struct/array)`
3. Encode/decode JSON
4. Encode/decode binary
5. Encode/decode [messagepack](https://msgpack.org/index.html)
6. Encode/decode XML
7. Decode INI
4. Encode/decode CSV
5. Encode/decode binary
6. Encode/decode [messagepack](https://msgpack.org/index.html)
7. Encode/decode XML
8. Decode INI

-----

Expand Down Expand Up @@ -53,6 +54,18 @@ Decodes a JSON string into nested struct/array data. This function will happily
&nbsp;
### snap_to_csv(array2D, [cellDelimiter], [stringDelimiter]) ###
Turns a 2D array into a CSV string. The 2D array must not contain further nested structs or arrays. The cell and string delimiters can be specified for compatibility with various different languages.
&nbsp;
### snap_from_csv(string, [cellDelimiter], [stringDelimiter]) ###
Decodes a CSV string into a 2D array. All values unpacked from the CSV string will be stored as strings - unfortunately, issues with `try...catch` in GMS2.3.0 runtime 23.1.1.146 prevent automatic detection of numeric values. As above, the cell and string delimiters can be defined, though they are limited to the first 127 ASCII characters.
&nbsp;
### snap_to_binary(struct/array) ###
Returns a buffer that holds binary encoded struct and array nested data. The root datatype can be either a struct or an array. This is substantially faster than `snap_to_json()`.
Expand Down
4 changes: 2 additions & 2 deletions scripts/snap_from_csv/snap_from_csv.gml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/// @return 2D array that represents the contents of the CSV string
///
/// @param string The CSV string to be decoded
/// @param [cellDelimiter] Character to use to indicate where cells start and end. Defaults to a comma
/// @param [stringDelimiter] Character to use to indicate where cells start and end. Defaults to a double quote
/// @param [cellDelimiter] Character to use to indicate where cells start and end. First 127 ASCII chars only. Defaults to a comma
/// @param [stringDelimiter] Character to use to indicate where strings start and end. First 127 ASCII chars only. Defaults to a double quote
///
/// @jujuadams 2020-06-28

Expand Down
4 changes: 2 additions & 2 deletions scripts/snap_to_csv/snap_to_csv.gml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// @return CSV string that encodes the provided 2D array
///
/// @param array2D The 2D array to encode
/// @param [cellDelimiter] Character to use to indicate where cells start and end. Defaults to a comma
/// @param [stringDelimiter] Character to use to indicate where cells start and end. Defaults to a double quote
/// @param [cellDelimiter] Character to use to indicate where cells start and end. First 127 ASCII chars only. Defaults to a comma
/// @param [stringDelimiter] Character to use to indicate where strings start and end. First 127 ASCII chars only. Defaults to a double quote
///
/// @jujuadams 2020-06-28

Expand Down
12 changes: 6 additions & 6 deletions snap.yyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"resources": [
{"id":{"name":"snap_from_xml","path":"scripts/snap_from_xml/snap_from_xml.yy",},"order":11,},
{"id":{"name":"snap_to_xml","path":"scripts/snap_to_xml/snap_to_xml.yy",},"order":10,},
{"id":{"name":"snap_to_csv","path":"scripts/snap_to_csv/snap_to_csv.yy",},"order":8,},
{"id":{"name":"snap_to_csv","path":"scripts/snap_to_csv/snap_to_csv.yy",},"order":4,},
{"id":{"name":"snap_deep_copy","path":"scripts/snap_deep_copy/snap_deep_copy.yy",},"order":1,},
{"id":{"name":"oTestCSV","path":"objects/oTestCSV/oTestCSV.yy",},"order":5,},
{"id":{"name":"oTestINI","path":"objects/oTestINI/oTestINI.yy",},"order":7,},
{"id":{"name":"snap_from_json","path":"scripts/snap_from_json/snap_from_json.yy",},"order":3,},
{"id":{"name":"foreach","path":"scripts/foreach/foreach.yy",},"order":0,},
{"id":{"name":"snap_to_json","path":"scripts/snap_to_json/snap_to_json.yy",},"order":2,},
{"id":{"name":"snap_from_binary","path":"scripts/snap_from_binary/snap_from_binary.yy",},"order":5,},
{"id":{"name":"snap_from_binary","path":"scripts/snap_from_binary/snap_from_binary.yy",},"order":7,},
{"id":{"name":"oTestJSON","path":"objects/oTestJSON/oTestJSON.yy",},"order":2,},
{"id":{"name":"snap_to_binary","path":"scripts/snap_to_binary/snap_to_binary.yy",},"order":4,},
{"id":{"name":"snap_to_messagepack","path":"scripts/snap_to_messagepack/snap_to_messagepack.yy",},"order":6,},
{"id":{"name":"snap_from_csv","path":"scripts/snap_from_csv/snap_from_csv.yy",},"order":9,},
{"id":{"name":"snap_to_binary","path":"scripts/snap_to_binary/snap_to_binary.yy",},"order":6,},
{"id":{"name":"snap_to_messagepack","path":"scripts/snap_to_messagepack/snap_to_messagepack.yy",},"order":8,},
{"id":{"name":"snap_from_csv","path":"scripts/snap_from_csv/snap_from_csv.yy",},"order":5,},
{"id":{"name":"snap_from_ini_string","path":"scripts/snap_from_ini_string/snap_from_ini_string.yy",},"order":12,},
{"id":{"name":"snap_from_messagepack","path":"scripts/snap_from_messagepack/snap_from_messagepack.yy",},"order":7,},
{"id":{"name":"snap_from_messagepack","path":"scripts/snap_from_messagepack/snap_from_messagepack.yy",},"order":9,},
{"id":{"name":"oTestMessagepack","path":"objects/oTestMessagepack/oTestMessagepack.yy",},"order":4,},
{"id":{"name":"snap_from_ini_file","path":"scripts/snap_from_ini_file/snap_from_ini_file.yy",},"order":13,},
{"id":{"name":"oTestXML","path":"objects/oTestXML/oTestXML.yy",},"order":6,},
Expand Down

0 comments on commit 09e1d07

Please sign in to comment.