Skip to content

Commit

Permalink
Adds function to read a string from a file
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Aug 16, 2020
1 parent 60b56e4 commit 19541c5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
4 changes: 1 addition & 3 deletions options/main/options_main.yy
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
"option_sci_usesci": false,
"option_author": "",
"option_lastchanged": "",
"addon_amazon_apis": "",
"addon_google_play_services": "",
"option_spine_licence": false,
"resourceVersion": "1.1",
"resourceVersion": "1.2",
"name": "Main",
"tags": [],
"resourceType": "GMMainOptions",
Expand Down
13 changes: 13 additions & 0 deletions scripts/string_from_file/string_from_file.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// @return String that represents all the text inside the file
///
/// @param filename File to parse
///
/// @jujuadams 2020-08-16

function string_from_file(_filename)
{
var _buffer = buffer_load(_filename);
var _string = buffer_read(_buffer, buffer_string);
buffer_delete(_buffer);
return _string;
}
12 changes: 12 additions & 0 deletions scripts/string_from_file/string_from_file.yy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "Struct N' Array Parser",
"path": "folders/Struct N' Array Parser.yy",
},
"resourceVersion": "1.0",
"name": "string_from_file",
"tags": [],
"resourceType": "GMScript",
}
3 changes: 2 additions & 1 deletion snap.yyp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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":"string_from_file","path":"scripts/string_from_file/string_from_file.yy",},"order":14,},
{"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":6,},
Expand Down Expand Up @@ -60,7 +61,7 @@
{"CopyToMask":153720560310812910,"filePath":"datafiles","resourceVersion":"1.0","name":"README.md","resourceType":"GMIncludedFile",},
],
"MetaData": {
"IDEVersion": "23.1.1.157",
"IDEVersion": "23.1.1.175",
},
"resourceVersion": "1.3",
"name": "SNAP",
Expand Down

0 comments on commit 19541c5

Please sign in to comment.