Skip to content

Commit

Permalink
more docs fixes (#330)
Browse files Browse the repository at this point in the history
* more docs fixes

* remove older wasm info

* fix wether and gen builtin funcs again

* undo builtin funcs
  • Loading branch information
lesleyrs authored Sep 4, 2024
1 parent 92ff74f commit f60b0a3
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dev/src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ nfr("delete_file", "file", "S", "B", "deletes a file, returns false if it wasn't
return Value(ok);
});

nfr("exists_file", "file", "S", "B", "checks wether a file exists.",
nfr("exists_file", "file", "S", "B", "checks whether a file exists.",
[](StackPtr &, VM &, Value &file) {
auto ok = FileExists(file.sval()->strv(), false);
return Value(ok);
Expand Down
2 changes: 1 addition & 1 deletion dev/src/lobster/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ struct CodeGen {
ser_ids.resize(max_ser_ids, (type_elem_t)-1);
for (auto udt : parser.st.udttable) {
if (!udt->g.is_abstract) {
// We generate a type table for every UDT regardless of wether it is referred to
// We generate a type table for every UDT regardless of whether it is referred to
// anywhere, for example (sub)classes may be constructed by deserializing them and
// not in code.
udt->ComputeSizes();
Expand Down
2 changes: 1 addition & 1 deletion docs/engine.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1 class="title">Lobster built-in engine functionality</h1>
</header>
<p>Lobster comes with "batteries included": a small (games/graphics)
engine that allows you to start drawing straight away. This doc collects
some notes on the the built-in functionality.</p>
some notes on the built-in functionality.</p>
<h2 id="basics">Basics</h2>
<p>The basic list of <a href="builtin_functions_reference.html">builtin
functions</a> is worth browsing first, as well as the <a
Expand Down
2 changes: 1 addition & 1 deletion docs/implementation.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ <h2 id="compiling-lobster-code-to-c">Compiling Lobster code to C++</h2>
automatically substitute the compiled lobster main program. Build with
<code>make -j8</code> or similar.</p>
<p>For Emscripten, there's a <code>cpp</code> make target (which is the
default) that works similar to the WebAssembly mode described below.</p>
default).</p>
<h2 id="extending-lobster">Extending Lobster</h2>
<p>Besides using Lobster as a stand-alone programming language as-is,
there are 2 ways of extending Lobster, by adding your code to Lobster,
Expand Down
12 changes: 6 additions & 6 deletions docs/language_reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,10 @@ <h3 id="scope">Scope</h3>
<h3 id="overloading-and-dynamic-dispatch">Overloading and dynamic
dispatch</h3>
<p>Overloading and dynamic dispatch are part of the same system, the
only difference being wether choosing the right function is done at
only difference being whether choosing the right function is done at
compile time or runtime.</p>
<p>You can define these overloads anywhere, either as part of a class,
or outside of them, regardless of wether you wrote the original class.
or outside of them, regardless of whether you wrote the original class.
For example:</p>
<pre><code>def f(a::A): return 1
def f(b::B): return 2
Expand All @@ -569,10 +569,10 @@ <h3 id="overloading-and-dynamic-dispatch">Overloading and dynamic
dynamic dispatch, since the argument may point to a <code>B</code>
value, and <code>B</code> has a different function implementation. A
dynamic dispatch goes thru a "virtual table", and while slower than
static dispatch, is still very fast. As you can see, wether something is
"virtual" gets decided per call, and with knowledge of the whole program
(all types and functions that can possibly exist), so typically less
calls result in dynamic dispatch than in other languages.</p>
static dispatch, is still very fast. As you can see, whether something
is "virtual" gets decided per call, and with knowledge of the whole
program (all types and functions that can possibly exist), so typically
less calls result in dynamic dispatch than in other languages.</p>
<p>Types like <code>int</code> never participate in dynamic dispatch,
since they don't have a sub-class relation to any other type.</p>
<p>Defining these functions can also be done "in line" in a class
Expand Down
3 changes: 2 additions & 1 deletion docs/shooter_tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ <h3 id="score-and-game-over">6: Score, and Game Over</h3>
health in float, but want to show only the whole numbers.
<code>ceiling</code> here is better than <code>truncate</code>, since we
only want to show <code>0</code> when the player is truely dead.</p>
<pre><code> if magnitude(playervec) &lt; 1.0:
<pre><code> let playervec = playerpos - e.pos
if magnitude(playervec) &lt; 1.0:
playerhealth -= gl.delta_time() * 50.0
if playerhealth &lt;= 0.0:
playerhealth = 0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/source/engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Lobster built-in engine functionality
---

Lobster comes with "batteries included": a small (games/graphics) engine that allows you to start
drawing straight away. This doc collects some notes on the the built-in functionality.
drawing straight away. This doc collects some notes on the built-in functionality.

Basics
------
Expand Down
3 changes: 1 addition & 2 deletions docs/source/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ On Linux, building in `dev` like above, then instead
`cmake -DLOBSTER_TOCPP=ON -DCMAKE_BUILD_TYPE=Release .` will automatically
substitute the compiled lobster main program. Build with `make -j8` or similar.

For Emscripten, there's a `cpp` make target (which is the default) that works
similar to the WebAssembly mode described below.
For Emscripten, there's a `cpp` make target (which is the default).

Extending Lobster
-----------------
Expand Down
6 changes: 3 additions & 3 deletions docs/source/language_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,10 @@ have no overhead compared to regular functions and variables.
### Overloading and dynamic dispatch

Overloading and dynamic dispatch are part of the same system, the only difference
being wether choosing the right function is done at compile time or runtime.
being whether choosing the right function is done at compile time or runtime.

You can define these overloads anywhere, either as part of a class, or outside
of them, regardless of wether you wrote the original class. For example:
of them, regardless of whether you wrote the original class. For example:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def f(a::A): return 1
Expand All @@ -670,7 +670,7 @@ there is statically only one option.
Only if you call with an `A` argument however, you get dynamic dispatch,
since the argument may point to a `B` value, and `B` has a different function
implementation. A dynamic dispatch goes thru a "virtual table", and while slower than
static dispatch, is still very fast. As you can see, wether something is "virtual" gets
static dispatch, is still very fast. As you can see, whether something is "virtual" gets
decided per call, and with knowledge of the whole program (all types and functions that
can possibly exist), so typically less calls result in dynamic dispatch than in other
languages.
Expand Down
1 change: 1 addition & 0 deletions docs/source/shooter_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ whole numbers. `ceiling` here is better than `truncate`, since we only want to
show `0` when the player is truely dead.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let playervec = playerpos - e.pos
if magnitude(playervec) < 1.0:
playerhealth -= gl.delta_time() * 50.0
if playerhealth <= 0.0:
Expand Down

0 comments on commit f60b0a3

Please sign in to comment.