Ver código fonte

docs: Add example for pushing FieldVector

Ole 10 anos atrás
pai
commit
d0e68b6c0f

+ 15 - 5
docs/mkdocs/basics.md

@@ -57,16 +57,26 @@ luwra::push(lua, false);
 
 
 // Push a string
 // Push a string
 luwra::push(lua, "Hello World");
 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:
 This produces the following stack layout:
 
 
 Absolute Position | Relative Position | Value
 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.
 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.
 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);
 int value = luwra::read<int>(lua, 1);
 
 
 // Similiar with a relative index
 // Similiar with a relative index
-int value = luwra::read<int>(lua, -4);
+int value = luwra::read<int>(lua, -5);
 ```
 ```
 
 
 ## Read and type errors
 ## Read and type errors

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

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

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
docs/output/mkdocs/search_index.json


+ 5 - 5
docs/output/sitemap.xml

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

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff