Преглед изворни кода

docs: Add example for pushing FieldVector

Ole пре 9 година
родитељ
комит
d0e68b6c0f

+ 15 - 5
docs/mkdocs/basics.md

@@ -57,16 +57,26 @@ luwra::push(lua, false);
 
 // Push a string
 luwra::push(lua, "Hello World");
+
+// Push a table
+luwra::push(lua, luwra::FieldVector {
+	{"one", 1},
+	{1, "one"},
+	{"nested", luwra::FieldVector {
+		{"more", "fields"}
+	}}
+});
 ```
 
 This produces the following stack layout:
 
 Absolute Position | Relative Position | Value
 ------------------|-------------------|------
-1                 | -4                | `1338`
-2                 | -3                | `13.37`
-3                 | -2                | `false`
-4                 | -1                | `"Hello World"`
+1                 | -5                | `1338`
+2                 | -4                | `13.37`
+3                 | -3                | `false`
+4                 | -2                | `"Hello World"`
+5                 | -1                | `{one = 1, [1] = "one", nested = {more = "fields"}}`
 
 It is possible to provide a template parameter to `push` to enforce pushing a specific type.
 In most cases you are probably better off by letting the compiler infer the template parameter.
@@ -81,7 +91,7 @@ stack layout from the previous example. This is how you would retrieve a value f
 int value = luwra::read<int>(lua, 1);
 
 // Similiar with a relative index
-int value = luwra::read<int>(lua, -4);
+int value = luwra::read<int>(lua, -5);
 ```
 
 ## Read and type errors

+ 19 - 5
docs/output/basics/index.html

@@ -308,6 +308,15 @@ luwra::push(lua, false);
 
 // Push a string
 luwra::push(lua, &quot;Hello World&quot;);
+
+// Push a table
+luwra::push(lua, luwra::FieldVector {
+    {&quot;one&quot;, 1},
+    {1, &quot;one&quot;},
+    {&quot;nested&quot;, luwra::FieldVector {
+        {&quot;more&quot;, &quot;fields&quot;}
+    }}
+});
 </code></pre>
 
 <p>This produces the following stack layout:</p>
@@ -322,24 +331,29 @@ luwra::push(lua, &quot;Hello World&quot;);
 <tbody>
 <tr>
 <td>1</td>
-<td>-4</td>
+<td>-5</td>
 <td><code>1338</code></td>
 </tr>
 <tr>
 <td>2</td>
-<td>-3</td>
+<td>-4</td>
 <td><code>13.37</code></td>
 </tr>
 <tr>
 <td>3</td>
-<td>-2</td>
+<td>-3</td>
 <td><code>false</code></td>
 </tr>
 <tr>
 <td>4</td>
-<td>-1</td>
+<td>-2</td>
 <td><code>"Hello World"</code></td>
 </tr>
+<tr>
+<td>5</td>
+<td>-1</td>
+<td><code>{one = 1, [1] = "one", nested = {more = "fields"}}</code></td>
+</tr>
 </tbody>
 </table>
 <p>It is possible to provide a template parameter to <code>push</code> to enforce pushing a specific type.
@@ -352,7 +366,7 @@ stack layout from the previous example. This is how you would retrieve a value f
 int value = luwra::read&lt;int&gt;(lua, 1);
 
 // Similiar with a relative index
-int value = luwra::read&lt;int&gt;(lua, -4);
+int value = luwra::read&lt;int&gt;(lua, -5);
 </code></pre>
 
 <h2 id="read-and-type-errors">Read and type errors</h2>

+ 1 - 1
docs/output/index.html

@@ -193,5 +193,5 @@ your preference.</p>
 
 <!--
 MkDocs version : 0.15.3
-Build Date UTC : 2016-05-06 20:15:44.620000
+Build Date UTC : 2016-05-06 22:51:43.699998
 -->

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
docs/output/mkdocs/search_index.json


+ 5 - 5
docs/output/sitemap.xml

@@ -4,7 +4,7 @@
     
     <url>
      <loc>None/</loc>
-     <lastmod>2016-05-06</lastmod>
+     <lastmod>2016-05-07</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -12,7 +12,7 @@
     
     <url>
      <loc>None/basics/</loc>
-     <lastmod>2016-05-06</lastmod>
+     <lastmod>2016-05-07</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -20,7 +20,7 @@
     
     <url>
      <loc>None/advanced/</loc>
-     <lastmod>2016-05-06</lastmod>
+     <lastmod>2016-05-07</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -28,7 +28,7 @@
     
     <url>
      <loc>None/wrapping/</loc>
-     <lastmod>2016-05-06</lastmod>
+     <lastmod>2016-05-07</lastmod>
      <changefreq>daily</changefreq>
     </url>
     
@@ -36,7 +36,7 @@
     
     <url>
      <loc>None/user-types/</loc>
-     <lastmod>2016-05-06</lastmod>
+     <lastmod>2016-05-07</lastmod>
      <changefreq>daily</changefreq>
     </url>
     

Неке датотеке нису приказане због велике количине промена