mirror of
https://github.com/celisej567/wiki.git
synced 2026-09-15 20:09:39 +03:00
Lua rundown
This commit is contained in:
73
dst/QScript/Lua/Classes.html
Normal file
73
dst/QScript/Lua/Classes.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<!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 Classes</h1>
|
||||
|
||||
<p>If you want to create a class, you first call the <code>class()</code> function like this:</p>
|
||||
|
||||
<pre><code>my_class = class() -- Creates a class creator
|
||||
</code></pre>
|
||||
|
||||
<p><code>my_class</code> becomes a class creator. You can think of it like a bowl of ingredients which you can add to by simply setting the values of it.</p>
|
||||
|
||||
<pre><code>my_class = class() -- Creates a class creator
|
||||
|
||||
my_class.MyVar = 50.0 -- Creates a variable inside the class
|
||||
function my_class.MyFunc(self,a) -- Creates a function inside the class
|
||||
return self.MyVar+a
|
||||
end
|
||||
</code></pre>
|
||||
|
||||
<p>Once you are done with defining your class, you call the <code>finish()</code> function like this:</p>
|
||||
|
||||
<pre><code>finish(my_class) -- Finishes the class
|
||||
</code></pre>
|
||||
|
||||
<p><code>my_class</code> will turn into a normal class where you cannot add any more variables or functions to it. In other words, <code>my_class</code> will get "baked" and you cannot add any more ingredients to it.</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p><a href="/wiki/QScript/Lua/Objects.html">Next -></a></p>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user