summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2024-12-21 14:02:14 -0600
committerAlexander M Pickering <alex@cogarr.net>2024-12-21 14:02:14 -0600
commitd6233646bdfc0119ce528c206dbacc69ef28942e (patch)
tree97f01060d29e9060cdc3e868eaaef0ffee3f46c2
parentca318b560a225539e30e4b4fc5daeb5477ac638a (diff)
downloadwebsite-d6233646bdfc0119ce528c206dbacc69ef28942e.tar.gz
website-d6233646bdfc0119ce528c206dbacc69ef28942e.tar.bz2
website-d6233646bdfc0119ce528c206dbacc69ef28942e.zip
Update moonscript example
-rw-r--r--html/index.html18
1 files changed, 11 insertions, 7 deletions
diff --git a/html/index.html b/html/index.html
index 53a724c..48c86bf 100644
--- a/html/index.html
+++ b/html/index.html
@@ -63,7 +63,7 @@ os.execute("notepad.exe " .. note_filename)</code></pre>
63 <pre><code class="language-bash">$ lua note.lua my first note</code></pre> 63 <pre><code class="language-bash">$ lua note.lua my first note</code></pre>
64 </div> 64 </div>
65 </div> 65 </div>
66 <p>Run <code>lua --help</code> for more options for the command line tool, and the <a href="https://www.lua.org/manual/5.1/manual.html">Lua Manual</a> for extensive documentation of the Lua programming language. Also note <a href="https://luajit.org/extensions.html">LuaJIT's extensions</a></p> 66 <p>Run <code>lua --help</code> for more options for the command line tool, and see the <a href="https://www.lua.org/manual/5.1/manual.html">Lua Manual</a> for extensive documentation of the Lua programming language and standard libraries. Also note <a href="https://luajit.org/extensions.html">LuaJIT's extensions</a></p>
67 </section> 67 </section>
68 <section class="container" id="luarocks"> 68 <section class="container" id="luarocks">
69 <h3 class="title">Installing Superpowers</h3> 69 <h3 class="title">Installing Superpowers</h3>
@@ -103,15 +103,20 @@ print(green .. "> implying you need modules")</code></pre>
103<pre><code class="language-bash">$ luarocks install moonscript</code></pre> 103<pre><code class="language-bash">$ luarocks install moonscript</code></pre>
104 </div> 104 </div>
105 <div class="column"> 105 <div class="column">
106<pre><code class="language-moonscript">class World 106<pre><code class="language-moonscript">class Person
107 greet: => print("Hello, world!") 107 name: "Alex"
108 greet: => print("Hello, " .. @name)
109
110class World extends Person
111 name: "World"
108 112
109with World! 113with World!
110 \greet!</code></pre> 114 \greet!
115</code></pre>
111 </div> 116 </div>
112 <div class="column"> 117 <div class="column">
113<pre><code class="language-bash">$ moon example.moon 118<pre><code class="language-bash">$ moon example.moon
114Hello, world!</code></pre> 119Hello, World!</code></pre>
115 </div> 120 </div>
116 </div> 121 </div>
117 <br/> 122 <br/>
@@ -126,8 +131,7 @@ Hello, world!</code></pre>
126 <pre><code class="language-bash">$ luarocks install tl</code></pre> 131 <pre><code class="language-bash">$ luarocks install tl</code></pre>
127 </div> 132 </div>
128 <div class="column"> 133 <div class="column">
129 <pre><code class="language-teal"> 134 <pre><code class="language-teal">local function keys&lt;K,V&gt;(xs: {K:V}):{K}
130local function keys&lt;K,V&gt;(xs: {K:V}):{K}
131 local ks = {} 135 local ks = {}
132 for k, _ in pairs(xs) do 136 for k, _ in pairs(xs) do
133 table.insert(ks, k) 137 table.insert(ks, k)