Skip to content

Commit

Permalink
[General] Document that load_csv only loads strings; update the example
Browse files Browse the repository at this point in the history
  • Loading branch information
gurpreetsinghmatharoo committed Feb 23, 2024
1 parent e6e66a7 commit 94ea140
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>load_csv</title>
<meta name="generator" content="Adobe RoboHelp 2020" />
<meta name="generator" content="Adobe RoboHelp 2022" />
<link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css" />
<script src="../../../../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander" />
Expand All @@ -18,6 +18,7 @@
<h1>load_csv</h1>
<p>This function will load a CSV format file and convert it into a DS grid, returning the unique ID value for the grid created.</p>
<p>Your CSV file should follow the <a href="http://super-csv.github.io/super-csv/csv_specification.html" title="CSV specification">CSV specification</a>. If your CSV syntax is not correct, you will get unexpected results on loading the file.</p>
<p>This will load each cell as a <a href="../../../GML_Overview/Data_Types.htm">string</a>, even if it only contains numbers. Use the function <span class="inline3_func"><a href="../../Strings/real.htm">real</a></span> to convert a string into number.</p>
<p> </p>
<h4>Syntax:</h4>
<p class="code">load_csv(filename)</p>
Expand All @@ -30,14 +31,14 @@ <h4>Syntax:</h4>
</tr>
<tr>
<td>filename</td>
<td><span data-keyref="Type_String"><a href="../../../../../GameMaker_Language/GML_Overview/Data_Types.htm" target="_blank">String</a></span></td>
<td><span data-keyref="Type_String"><a href="../../../GML_Overview/Data_Types.htm" target="_blank">String</a></span></td>
<td>The name of the file to open (as a string)</td>
</tr>
</tbody>
</table>
<p> </p>
<h4>Returns:</h4>
<p class="code"><span data-keyref="Type_ID_DS_Grid"><a href="../../../../../GameMaker_Language/GML_Reference/Data_Structures/DS_Grids/ds_grid_create.htm" target="_blank">DS Grid ID</a></span></p>
<p class="code"><span data-keyref="Type_ID_DS_Grid"><a href="../../Data_Structures/DS_Grids/ds_grid_create.htm" target="_blank">DS Grid</a></span></p>
<p> </p>
<h4>Example:</h4>
<p class="code">file_grid = load_csv(&quot;spreadsheet.csv&quot;);<br />
Expand All @@ -49,7 +50,7 @@ <h4>Example:</h4>
{<br />
    for (var j = 0; j &lt; hh; j++;)<br />
    {<br />
        draw_text(xx, yy, string(file_grid[# i, j]));<br />
        draw_text(xx, yy, file_grid[# i, j]);<br />
        yy += 32;<br />
    }<br />
    yy = 32;<br />
Expand Down

0 comments on commit 94ea140

Please sign in to comment.