-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 63d49e6
Showing
20 changed files
with
3,247 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<head> | ||
<title>LEGE Documentation</title> | ||
<link rel="stylesheet" href="../ldoc.css" type="text/css" /> | ||
</head> | ||
<body> | ||
|
||
<div id="container"> | ||
|
||
<div id="product"> | ||
<div id="product_logo"></div> | ||
<div id="product_name"><big><b></b></big></div> | ||
<div id="product_description"></div> | ||
</div> <!-- id="product" --> | ||
|
||
|
||
<div id="main"> | ||
|
||
|
||
<!-- Menu --> | ||
|
||
<div id="navigation"> | ||
<br/> | ||
<h1>LEGE</h1> | ||
|
||
|
||
<ul> | ||
<li><a href="../index.html">Index</a></li> | ||
</ul> | ||
|
||
|
||
|
||
<h2>Examples</h2> | ||
<ul class="nowrap"> | ||
<li><strong>enums.lua</strong></li> | ||
<li><a href="../examples/hello_world.c.html">hello_world.c</a></li> | ||
<li><a href="../examples/logging.lua.html">logging.lua</a></li> | ||
<li><a href="../examples/preload.c.html">preload.c</a></li> | ||
<li><a href="../examples/readonly_tables..lua.html">readonly_tables..lua</a></li> | ||
<li><a href="../examples/strict_structs.lua.html">strict_structs.lua</a></li> | ||
<li><a href="../examples/using_strict.lua.html">using_strict.lua</a></li> | ||
<li><a href="../examples/weak_tables.lua.html">weak_tables.lua</a></li> | ||
</ul> | ||
<h2>Modules</h2> | ||
<ul class="nowrap"> | ||
<li><a href="../modules/lege.c_libs.html">lege.c_libs</a></li> | ||
<li><a href="../modules/lege.enum.html">lege.enum</a></li> | ||
<li><a href="../modules/lege.log.html">lege.log</a></li> | ||
<li><a href="../modules/lege.readonly.html">lege.readonly</a></li> | ||
<li><a href="../modules/lege.strict.html">lege.strict</a></li> | ||
<li><a href="../modules/lege.struct.html">lege.struct</a></li> | ||
<li><a href="../modules/lege.weak.html">lege.weak</a></li> | ||
<li><a href="../modules/lib.util.html">lib.util</a></li> | ||
</ul> | ||
<h2>Topics</h2> | ||
<ul class=""> | ||
<li><a href="../topics/README.md.html">README</a></li> | ||
</ul> | ||
|
||
</div> | ||
|
||
<div id="content"> | ||
|
||
<h2>enums.lua</h2> | ||
<pre> | ||
<span class="comment">--- Demonstrates the <a href="../modules/lege.enum.html#">lege.enum</a> module. | ||
</span><span class="comment">-- Enums are useful when you need to store a pre-defined set of values or options. | ||
</span> | ||
<span class="keyword">local</span> enum = <span class="global">require</span> <span class="string">"lege.enum"</span> | ||
|
||
<span class="comment">-- Define an enum | ||
</span><span class="keyword">local</span> Color = <span class="function-name">enum</span> <span class="string">'Color'</span> { | ||
<span class="comment">-- Strings with numeric keys define enum values | ||
</span> <span class="string">"red"</span>, | ||
<span class="string">"green"</span>, | ||
<span class="string">"blue"</span>, | ||
<span class="comment">-- String keys allow you to define a different value | ||
</span> dark_orange = <span class="string">"red"</span>, | ||
<span class="comment">-- Values don't have to be strings, but keys do | ||
</span> black = <span class="number">0</span>, | ||
} | ||
|
||
<span class="global">print</span>(Color) <span class="comment">--> enum Color: 0xdeadbeaf | ||
</span> | ||
<span class="global">assert</span>(Color.red == <span class="string">"red"</span>) | ||
<span class="global">assert</span>(Color.green == <span class="string">"green"</span>) | ||
<span class="global">assert</span>(Color.blue == <span class="string">"blue"</span>) | ||
<span class="global">assert</span>(Color.dark_orange == <span class="string">"red"</span>) | ||
<span class="global">assert</span>(Color.black == <span class="number">0</span>) | ||
|
||
<span class="comment">-- Trying to access an undefined enum value is an error | ||
</span><span class="comment">-- print(Color.white) --> Error: no value 'white' on enum 'Color' | ||
</span><span class="comment">-- Likewise trying to set a value is an error | ||
</span><span class="comment">-- Color.White = 255 --> Error: attempt to set value 'White' on enum 'Color'</span></pre> | ||
|
||
|
||
</div> <!-- id="content" --> | ||
</div> <!-- id="main" --> | ||
<div id="about"> | ||
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | ||
<i style="float:right;">Last updated 2024-02-27 22:49:18 </i> | ||
</div> <!-- id="about" --> | ||
</div> <!-- id="container" --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<head> | ||
<title>LEGE Documentation</title> | ||
<link rel="stylesheet" href="../ldoc.css" type="text/css" /> | ||
</head> | ||
<body> | ||
|
||
<div id="container"> | ||
|
||
<div id="product"> | ||
<div id="product_logo"></div> | ||
<div id="product_name"><big><b></b></big></div> | ||
<div id="product_description"></div> | ||
</div> <!-- id="product" --> | ||
|
||
|
||
<div id="main"> | ||
|
||
|
||
<!-- Menu --> | ||
|
||
<div id="navigation"> | ||
<br/> | ||
<h1>LEGE</h1> | ||
|
||
|
||
<ul> | ||
<li><a href="../index.html">Index</a></li> | ||
</ul> | ||
|
||
|
||
|
||
<h2>Examples</h2> | ||
<ul class="nowrap"> | ||
<li><a href="../examples/enums.lua.html">enums.lua</a></li> | ||
<li><strong>hello_world.c</strong></li> | ||
<li><a href="../examples/logging.lua.html">logging.lua</a></li> | ||
<li><a href="../examples/preload.c.html">preload.c</a></li> | ||
<li><a href="../examples/readonly_tables..lua.html">readonly_tables..lua</a></li> | ||
<li><a href="../examples/strict_structs.lua.html">strict_structs.lua</a></li> | ||
<li><a href="../examples/using_strict.lua.html">using_strict.lua</a></li> | ||
<li><a href="../examples/weak_tables.lua.html">weak_tables.lua</a></li> | ||
</ul> | ||
<h2>Modules</h2> | ||
<ul class="nowrap"> | ||
<li><a href="../modules/lege.c_libs.html">lege.c_libs</a></li> | ||
<li><a href="../modules/lege.enum.html">lege.enum</a></li> | ||
<li><a href="../modules/lege.log.html">lege.log</a></li> | ||
<li><a href="../modules/lege.readonly.html">lege.readonly</a></li> | ||
<li><a href="../modules/lege.strict.html">lege.strict</a></li> | ||
<li><a href="../modules/lege.struct.html">lege.struct</a></li> | ||
<li><a href="../modules/lege.weak.html">lege.weak</a></li> | ||
<li><a href="../modules/lib.util.html">lib.util</a></li> | ||
</ul> | ||
<h2>Topics</h2> | ||
<ul class=""> | ||
<li><a href="../topics/README.md.html">README</a></li> | ||
</ul> | ||
|
||
</div> | ||
|
||
<div id="content"> | ||
|
||
<h2>hello_world.c</h2> | ||
<pre> | ||
<span class="comment">/** | ||
* Shows how to initialize a LEGE engine and load some Lua code into it. | ||
*/</span> | ||
|
||
#include <lege.h> | ||
#include <stdio.h> | ||
|
||
<span class="keyword">int</span> <span class="function-name">main</span>(<span class="keyword">void</span>) { | ||
lege_engine_t engine = <span class="function-name">lege_engine_new</span>(); | ||
<span class="keyword">if</span> (!engine) { | ||
<span class="function-name">perror</span>(<span class="string">"Failed to create engine"</span>); | ||
<span class="keyword">return</span> <span class="number">1</span>; | ||
} | ||
<span class="function-name">lege_engine_set_string</span>(engine, LEGE_OPTION_APP_NAME, <span class="string">"Hello World"</span>); | ||
<span class="function-name">lege_engine_set_string</span>(engine, LEGE_OPTION_ORG_NAME, <span class="string">"lower-elements"</span>); | ||
<span class="function-name">lege_engine_load_literal</span>(engine, <span class="string">"print('Hello, world!')"</span>, <span class="string">"init.lua"</span>); | ||
<span class="function-name">lege_engine_run</span>(engine); | ||
<span class="function-name">lege_engine_free</span>(engine); | ||
<span class="keyword">return</span> <span class="number">0</span>; | ||
}</pre> | ||
|
||
|
||
</div> <!-- id="content" --> | ||
</div> <!-- id="main" --> | ||
<div id="about"> | ||
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | ||
<i style="float:right;">Last updated 2024-02-27 22:49:18 </i> | ||
</div> <!-- id="about" --> | ||
</div> <!-- id="container" --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<head> | ||
<title>LEGE Documentation</title> | ||
<link rel="stylesheet" href="../ldoc.css" type="text/css" /> | ||
</head> | ||
<body> | ||
|
||
<div id="container"> | ||
|
||
<div id="product"> | ||
<div id="product_logo"></div> | ||
<div id="product_name"><big><b></b></big></div> | ||
<div id="product_description"></div> | ||
</div> <!-- id="product" --> | ||
|
||
|
||
<div id="main"> | ||
|
||
|
||
<!-- Menu --> | ||
|
||
<div id="navigation"> | ||
<br/> | ||
<h1>LEGE</h1> | ||
|
||
|
||
<ul> | ||
<li><a href="../index.html">Index</a></li> | ||
</ul> | ||
|
||
|
||
|
||
<h2>Examples</h2> | ||
<ul class="nowrap"> | ||
<li><a href="../examples/enums.lua.html">enums.lua</a></li> | ||
<li><a href="../examples/hello_world.c.html">hello_world.c</a></li> | ||
<li><strong>logging.lua</strong></li> | ||
<li><a href="../examples/preload.c.html">preload.c</a></li> | ||
<li><a href="../examples/readonly_tables..lua.html">readonly_tables..lua</a></li> | ||
<li><a href="../examples/strict_structs.lua.html">strict_structs.lua</a></li> | ||
<li><a href="../examples/using_strict.lua.html">using_strict.lua</a></li> | ||
<li><a href="../examples/weak_tables.lua.html">weak_tables.lua</a></li> | ||
</ul> | ||
<h2>Modules</h2> | ||
<ul class="nowrap"> | ||
<li><a href="../modules/lege.c_libs.html">lege.c_libs</a></li> | ||
<li><a href="../modules/lege.enum.html">lege.enum</a></li> | ||
<li><a href="../modules/lege.log.html">lege.log</a></li> | ||
<li><a href="../modules/lege.readonly.html">lege.readonly</a></li> | ||
<li><a href="../modules/lege.strict.html">lege.strict</a></li> | ||
<li><a href="../modules/lege.struct.html">lege.struct</a></li> | ||
<li><a href="../modules/lege.weak.html">lege.weak</a></li> | ||
<li><a href="../modules/lib.util.html">lib.util</a></li> | ||
</ul> | ||
<h2>Topics</h2> | ||
<ul class=""> | ||
<li><a href="../topics/README.md.html">README</a></li> | ||
</ul> | ||
|
||
</div> | ||
|
||
<div id="content"> | ||
|
||
<h2>logging.lua</h2> | ||
<pre> | ||
<span class="comment">--- Example of LEGE's logging facilities via the <a href="../modules/lege.log.html#">lege.log</a> module | ||
</span><span class="comment">-- Logging can be useful when debugging your application, or to provide the user with information they can use when | ||
</span><span class="comment">-- filing a bug report. | ||
</span> | ||
<span class="keyword">local</span> log = <span class="global">require</span> <span class="string">"lege.log"</span> | ||
|
||
log.<span class="function-name">info</span>(<span class="string">"Log priority is currently set to "</span> .. log.<span class="function-name">get_priority</span>()) | ||
log.<span class="function-name">verbose</span>(<span class="string">"So you won't see this"</span>) | ||
log.<span class="function-name">set_priority</span>(<span class="string">"verbose"</span>) | ||
log.<span class="function-name">info</span>(<span class="string">"Log priority is now set to "</span> .. log.<span class="function-name">get_priority</span>()) | ||
|
||
log.<span class="function-name">verbose</span>(<span class="string">"The game's still running"</span>) | ||
log.<span class="global">debug</span>(<span class="string">"Starting frobnication process ..."</span>) | ||
log.<span class="function-name">info</span>(<span class="string">"Logged in as xx_DankMemer69_xx"</span>) | ||
log.<span class="function-name">warn</span>(<span class="string">"That username is stupid"</span>) | ||
log.<span class="global">error</span>(<span class="string">"The server rejected your username, as it is too stupid"</span>) | ||
log.<span class="function-name">critical</span>(<span class="string">"Cannot continue with a user this stupid"</span>) | ||
|
||
<span class="keyword">local</span> msg_type = <span class="string">"info"</span> | ||
log.<span class="function-name">message</span>(msg_type, <span class="string">"Yes, we're talking about *you*"</span>)</pre> | ||
|
||
|
||
</div> <!-- id="content" --> | ||
</div> <!-- id="main" --> | ||
<div id="about"> | ||
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> | ||
<i style="float:right;">Last updated 2024-02-27 22:49:18 </i> | ||
</div> <!-- id="about" --> | ||
</div> <!-- id="container" --> | ||
</body> | ||
</html> |
Oops, something went wrong.