diff options
author | Alexander M Pickering <alex@cogarr.net> | 2024-12-21 14:02:14 -0600 |
---|---|---|
committer | Alexander M Pickering <alex@cogarr.net> | 2024-12-21 14:02:14 -0600 |
commit | d6233646bdfc0119ce528c206dbacc69ef28942e (patch) | |
tree | 97f01060d29e9060cdc3e868eaaef0ffee3f46c2 | |
parent | ca318b560a225539e30e4b4fc5daeb5477ac638a (diff) | |
download | website-d6233646bdfc0119ce528c206dbacc69ef28942e.tar.gz website-d6233646bdfc0119ce528c206dbacc69ef28942e.tar.bz2 website-d6233646bdfc0119ce528c206dbacc69ef28942e.zip |
Update moonscript example
-rw-r--r-- | html/index.html | 18 |
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 | |||
110 | class World extends Person | ||
111 | name: "World" | ||
108 | 112 | ||
109 | with World! | 113 | with 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 |
114 | Hello, world!</code></pre> | 119 | Hello, 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<K,V>(xs: {K:V}):{K} |
130 | local function keys<K,V>(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) |