mirror of
https://github.com/celisej567/wiki.git
synced 2026-09-04 15:34:07 +03:00
77 lines
2.6 KiB
HTML
77 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
|
<script>
|
|
const documentlist = ['/wiki/index.html', '/wiki/QScript/Introduction.html', '/wiki/QScript/Lua/Classes.html', '/wiki/QScript/Lua/Exports.html', '/wiki/QScript/Lua/Imports.html', '/wiki/QScript/Lua/Objects.html', '/wiki/QScript/Tutorial/Chapter1.html']
|
|
const namelist = ['Wiki Intro', 'QScript Intro', 'Lua Classes', 'Lua Exports', 'Lua Imports', 'Lua Objects', 'QScript Tutorial Chapter 1']
|
|
|
|
function updateSearch() {
|
|
searchtext = document.getElementById("searchbox").value.toLowerCase();
|
|
var res = [];
|
|
var searchresults = document.getElementById("searchresults")
|
|
searchresults.innerHTML = ""
|
|
if(searchtext === "")
|
|
return;
|
|
for (var i = 0; i < namelist.length; i++)
|
|
{
|
|
if(!namelist[i].toLowerCase().includes(searchtext)) continue;
|
|
var searchelement = document.createElement("li");
|
|
var link = document.createElement("a");
|
|
searchelement.appendChild(link);
|
|
link.setAttribute("href", documentlist[i]);
|
|
link.innerHTML = namelist[i];
|
|
searchresults.appendChild(searchelement);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
<style>
|
|
pre {
|
|
margin-left:16px;
|
|
background-color: #EEE;
|
|
border-color: #CCC;
|
|
border-style:solid;
|
|
border-width:1px;
|
|
}
|
|
</style>
|
|
<div style="position:fixed; display:block; top: 0px; left: 0px; height:100%; width:200px;border-color: black; border-width: 1px; border-style:solid;">
|
|
<input type="text" placeholder="search..." autocomplete="off" id="searchbox" oninput="updateSearch();" style="width:192px;">
|
|
<nav>
|
|
<ul id="searchresults">
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
<div style="margin-left:200px;">
|
|
<h1>Lua Exports</h1>
|
|
|
|
<p>Here is the real meat and potatoes of QScript. The import/export system allows you to share objects, functions and classes between scripts and other languages! The system is stupidly simple to understand.</p>
|
|
|
|
<p>Here is a simple code example:</p>
|
|
|
|
<pre><code>function Add(a,b)
|
|
return a + b
|
|
end
|
|
|
|
export(Add)
|
|
</code></pre>
|
|
|
|
<p>That is it! Just put the global variable you want to export in the global scope (not inside another function) and the thing you want to export will get added to a special list which will contain all the exported elements from your file.</p>
|
|
|
|
<p>Exporting classes and objects works the same way.</p>
|
|
|
|
<pre><code>my_class = class()
|
|
|
|
finish(my_class)
|
|
|
|
my_object = object(my_class)
|
|
|
|
export(my_class)
|
|
export(my_object)
|
|
</code></pre>
|
|
|
|
<hr />
|
|
|
|
<p><a href="/wiki/QScript/Lua/Objects.html"><- Prev</a> |
|
|
<a href="/wiki/QScript/Lua/Imports.html">Next -></a></p>
|
|
|
|
</div> |