mirror of
https://github.com/celisej567/wiki.git
synced 2025-12-31 01:49:32 +03:00
520 lines
21 KiB
HTML
520 lines
21 KiB
HTML
<!DOCTYPE html>
|
|
<title>SourceBox Wiki</title>
|
|
<link rel="shortcut icon" href="/wiki/favicon.ico">
|
|
<script>
|
|
documentlist = ['/wiki/index.html', '/wiki/QScript/Introduction.html', '/wiki/QScript/Private_Members.html', '/wiki/QScript/Contributing/Contributing.html', '/wiki/QScript/Contributing/API/qscript.html', '/wiki/QScript/Contributing/API/Structs/QCFunc.html', '/wiki/QScript/Contributing/API/Structs/QModuleDefFunc.html', '/wiki/QScript/Contributing/API/Structs/QReturn.html', '/wiki/QScript/Contributing/API/Structs/QScriptArgs.html', '/wiki/QScript/Contributing/API/Structs/QScriptCallback.html', '/wiki/QScript/Contributing/API/Structs/QScriptClass.html', '/wiki/QScript/Contributing/API/Structs/QScriptClassCreator.html', '/wiki/QScript/Contributing/API/Structs/QScriptFunction.html', '/wiki/QScript/Contributing/API/Structs/QScriptObject.html', '/wiki/QScript/Contributing/API/Structs/QType.html', '/wiki/QScript/Contributing/API/Structs/QValue.html', '/wiki/QScript/Contributing/Internals/IBaseScriptingInterface.html', '/wiki/QScript/Contributing/Internals/QArgs.html', '/wiki/QScript/Contributing/Internals/QCallback.html', '/wiki/QScript/Contributing/Internals/QClass.html', '/wiki/QScript/Contributing/Internals/QFunction.html', '/wiki/QScript/Contributing/Internals/QInstance.html', '/wiki/QScript/Contributing/Internals/QInterface.html', '/wiki/QScript/Contributing/Internals/QMod.html', '/wiki/QScript/Contributing/Internals/QModule.html', '/wiki/QScript/Contributing/Internals/QObject.html', '/wiki/QScript/Contributing/Rundown/QScriptRundown1.html', '/wiki/QScript/Contributing/Rundown/QScriptRundown2.html', '/wiki/QScript/Contributing/Rundown/QScriptRundown3.html', '/wiki/QScript/Contributing/Rundown/QScriptRundown4.html', '/wiki/QScript/Contributing/Rundown/QScriptRundown5.html', '/wiki/QScript/Contributing/Rundown/QScriptRundown6.html', '/wiki/QScript/Lua/Classes.html', '/wiki/QScript/Lua/Exports.html', '/wiki/QScript/Lua/Imports.html', '/wiki/QScript/Lua/Intro.html', '/wiki/QScript/Lua/Objects.html', '/wiki/QScript/Squirrel/Exports_And_Imports.html', '/wiki/QScript/Squirrel/Intro.html', '/wiki/QScript/Tutorial/Chapter1.html', '/wiki/QScript/Tutorial/Chapter2.html'];
|
|
namelist = ['Wiki Intro', 'QScript Intro', 'Private Members', 'Contributing', 'QScript API', 'QCFunc', 'QModuleDefFunc', 'QReturn', 'QScriptArgs', 'QScriptCallback', 'QScriptClass', 'QScriptClassCreator', 'QScriptFunction', 'QScriptObject', 'QType', 'QValue', 'IBaseScriptingInterface', 'QArgs', 'QCallback', 'QClass', 'QFunction', 'QInstance', 'QInterface', 'QMod', 'QModule', 'QObject', 'QScript Rundown Page 1', 'QScript Rundown Page 2', 'QScript Rundown Page 3', 'QScript Rundown Page 4', 'QScript Rundown Page 5', 'QScript Rundown Page 6', 'Lua Classes', 'Lua Exports', 'Lua Imports', 'Lua Intro', 'Lua Objects', 'Squirrel Exports and Imports', 'Squirrel Intro', 'QScript Tutorial Page 1: Mods', 'QScript Tutorial Page 2: Getting to work'];
|
|
|
|
function toggleTree(element)
|
|
{
|
|
nested = element.parentNode.childNodes[3];
|
|
if(nested.className.indexOf("active",0) != -1)
|
|
{
|
|
nested.className = "sidebar nested";
|
|
element.parentNode.childNodes[0].innerHTML = "+";
|
|
}
|
|
else
|
|
{
|
|
nested.className = "sidebar nested active";
|
|
element.parentNode.childNodes[0].innerHTML = "-";
|
|
}
|
|
if(element.className.indexOf("active",0) != -1)
|
|
{
|
|
element.className = "spanactive"
|
|
}
|
|
else
|
|
{
|
|
element.className = "spanactive active"
|
|
}
|
|
}
|
|
|
|
function Press(element)
|
|
{
|
|
if(element.className.indexOf("active",0) != -1)
|
|
{
|
|
element.className = "spanactive active"
|
|
}
|
|
else
|
|
{
|
|
element.className = "spanactive"
|
|
}
|
|
}
|
|
|
|
function unPress(element)
|
|
{
|
|
if(element.className.indexOf("active",0) != -1)
|
|
{
|
|
element.className = "active"
|
|
}
|
|
else
|
|
{
|
|
element.className = ""
|
|
}
|
|
}
|
|
|
|
function updateSearch()
|
|
{
|
|
searchtext = document.getElementById("searchbox").value.toLowerCase();
|
|
var res = [];
|
|
var searchresults = document.getElementById("searchresults")
|
|
searchresults.innerHTML = ""
|
|
if(searchtext === "")
|
|
{
|
|
document.getElementById("filetree").style.display = "block"
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
document.getElementById("filetree").style.display = "none"
|
|
}
|
|
for (var i = 0; i < namelist.length; i++)
|
|
{
|
|
if(namelist[i].toLowerCase().indexOf(searchtext) == -1) continue;
|
|
var searchelement = document.createElement("li");
|
|
searchelement.className = "sidebar"
|
|
var link = document.createElement("a");
|
|
searchelement.appendChild(link);
|
|
link.setAttribute("href", documentlist[i]);
|
|
link.innerHTML = namelist[i];
|
|
searchresults.appendChild(searchelement);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
<link rel="stylesheet" href="/wiki/default.css">
|
|
<style>
|
|
|
|
hr
|
|
{
|
|
color: #463c2a;
|
|
}
|
|
|
|
code {
|
|
background-color: #383022;
|
|
border-color: #322b1e;
|
|
border-style:solid;
|
|
border-width:1px;
|
|
}
|
|
|
|
pre
|
|
{
|
|
margin-left:16px;
|
|
background-color: #383022;
|
|
border-color: #322b1e;
|
|
border-style:solid;
|
|
border-width:1px;
|
|
padding: 4px;
|
|
display:flex;
|
|
}
|
|
|
|
pre code
|
|
{
|
|
border: none !important;
|
|
}
|
|
|
|
td code {
|
|
background-color: #312A1D;
|
|
border-color: #2b2519;
|
|
}
|
|
|
|
.nested
|
|
{
|
|
display: none;
|
|
}
|
|
|
|
ul.sidebar.active
|
|
{
|
|
display: block !important;
|
|
}
|
|
|
|
ul.sidebar
|
|
{
|
|
padding-left: 0px;
|
|
}
|
|
|
|
li.sidebar ::marker
|
|
{
|
|
color:#00000000;
|
|
display:none;
|
|
}
|
|
|
|
li.sidebar
|
|
{
|
|
list-style-type: none !important;
|
|
background-color:#4A3F2C;
|
|
border-bottom: #312A1D 1px solid;
|
|
border-right: #312A1D 1px solid;
|
|
border-left: 1px solid #8d8881;
|
|
border-top: 1px solid #8d8881;
|
|
padding-left: 2px;
|
|
padding-bottom:2px;
|
|
padding-top:2px;
|
|
}
|
|
|
|
li ul li
|
|
{
|
|
margin-right:-1px;
|
|
}
|
|
|
|
li.sidebar span
|
|
{
|
|
-moz-user-select: none;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
z-index: 1;
|
|
cursor: pointer;
|
|
display: inline-block;
|
|
border: black 1px solid;
|
|
border-left-color: white;
|
|
border-top-color: white;
|
|
margin: 2px;
|
|
}
|
|
|
|
li.sidebar span span
|
|
{
|
|
-moz-user-select: none;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
z-index: 0;
|
|
border: #463c2a 1px solid;
|
|
background-color: #63553b;
|
|
color: white;
|
|
border-left-color: #8d8881;
|
|
border-top-color: #8d8881;
|
|
margin: 0px;
|
|
padding-left: 4px;
|
|
padding-right: 4px;
|
|
}
|
|
|
|
li.sidebar .spanactive
|
|
{
|
|
border-left-color: black;
|
|
border-top-color: black;
|
|
border-right-color: white;
|
|
border-bottom-color: white;
|
|
}
|
|
|
|
li.sidebar span .spanactive
|
|
{
|
|
border: #463c2a 1px solid;
|
|
border-right-color: #8d8881;
|
|
border-bottom-color: #8d8881;
|
|
}
|
|
|
|
|
|
.liicon
|
|
{
|
|
display:inline-block;
|
|
width:12px;
|
|
height:100%;
|
|
font-family: monospace;
|
|
font-size: 16px;
|
|
color: white;
|
|
}
|
|
|
|
nav
|
|
{
|
|
height: 100%;
|
|
}
|
|
|
|
a
|
|
{
|
|
color: #f79b08;
|
|
}
|
|
|
|
a:visited
|
|
{
|
|
color: #f79b08;
|
|
}
|
|
|
|
body
|
|
{
|
|
background-color: #4b402d;
|
|
color:white;
|
|
font-family:"Tahoma", sans-serif;
|
|
font-size:9pt;
|
|
}
|
|
|
|
.searchbox
|
|
{
|
|
border:none;
|
|
background-color: #3a3122;
|
|
color: white;
|
|
padding: 0px;
|
|
width:190px;
|
|
height:22px;
|
|
position: relative;
|
|
padding-left:4px;
|
|
padding-right:4px;
|
|
}
|
|
|
|
input:focus {
|
|
outline: none;
|
|
}
|
|
|
|
.searchboxcontainer
|
|
{
|
|
border: #2b2519 1px solid;
|
|
border-top-color: #837f7a;
|
|
border-left-color: #837f7a;
|
|
background-color: #3a3122;
|
|
position:relative;
|
|
margin-left:auto;
|
|
margin-right:0px;
|
|
height:24px;
|
|
width:198px;
|
|
position: absolute;
|
|
right: 9px;
|
|
}
|
|
|
|
|
|
.sidebarcontainer
|
|
{
|
|
float:right;
|
|
display:block;
|
|
top: -16px;
|
|
right: -8px;
|
|
margin-left: 8px;
|
|
margin-top: 8px;
|
|
margin-right: 8px;
|
|
width:200px;
|
|
border-color: black;
|
|
border-width: 1px;
|
|
border-style:solid;
|
|
position:relative;
|
|
overflow:auto;
|
|
padding:0px;
|
|
}
|
|
|
|
table
|
|
{
|
|
border: #312a1d 1px solid;
|
|
border-top-color: #837f7a;
|
|
border-left-color: #837f7a;
|
|
background-color: #423827;
|
|
}
|
|
|
|
th, td
|
|
{
|
|
border: #2b2519 1px solid;
|
|
border-right-color: #837f7a;
|
|
border-bottom-color: #837f7a;
|
|
background-color: #3a3122;
|
|
}
|
|
|
|
.sidebarroot
|
|
{
|
|
padding-left:0px !important;
|
|
margin:0px;
|
|
overflow:hidden;
|
|
}
|
|
|
|
.framed
|
|
{
|
|
border: #312a1d 1px solid;
|
|
border-top-color: #837f7a;
|
|
border-left-color: #837f7a;
|
|
background-color: #423827;
|
|
display: flow-root;
|
|
}
|
|
|
|
.framedinside
|
|
{
|
|
border: #2b2519 1px solid;
|
|
border-right-color: #837f7a;
|
|
border-bottom-color: #837f7a;
|
|
background-color: #3a3122;
|
|
margin:4px;
|
|
padding:2px;
|
|
text-align: center;
|
|
}
|
|
|
|
.framedinside *
|
|
{
|
|
margin:0px;
|
|
}
|
|
|
|
|
|
.inlineframed
|
|
{
|
|
border: #312a1d 1px solid;
|
|
border-top-color: #837f7a;
|
|
border-left-color: #837f7a;
|
|
background-color: #423827;
|
|
display:inline-block;
|
|
margin:4px;
|
|
}
|
|
|
|
.inlineframedinside
|
|
{
|
|
border: #312a1d 1px solid;
|
|
border-right-color: #837f7a;
|
|
border-bottom-color: #837f7a;
|
|
background-color: #4b402d;
|
|
margin:4px;
|
|
padding:8px;
|
|
}
|
|
|
|
|
|
|
|
.topbar
|
|
{
|
|
width:100%;
|
|
height:24px;
|
|
border: #312a1d 1px solid;
|
|
border-top-color: #837f7a;
|
|
border-left-color: #837f7a;
|
|
background-color: #423827;
|
|
margin-left:-2px;
|
|
}
|
|
|
|
.topbarelement
|
|
{
|
|
border: #2b2519 1px solid;
|
|
border-top-color: #837f7a;
|
|
border-left-color: #837f7a;
|
|
background-color: #3a3122;
|
|
}
|
|
|
|
|
|
</style>
|
|
<div class="topbar">
|
|
<img class="topbarelement" src="/wiki/sourceboxicon.png">
|
|
<span class="searchboxcontainer" onkeyup="updateSearch();"><input class="searchbox" type="text" placeholder="search..." autocomplete="off" id="searchbox" oninput="updateSearch();" class="searchbox"></span>
|
|
</div>
|
|
<div>
|
|
<div class="sidebarcontainer">
|
|
<nav>
|
|
<ul class="sidebar sidebarroot" id="searchresults">
|
|
</ul>
|
|
<ul class="sidebar sidebarroot" id="filetree">
|
|
<li class="sidebar"><a href="/wiki/index.html">Wiki Intro</a></li>
|
|
<li class="sidebar"><small class="liicon">-</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">QScript</span></span>
|
|
<ul class="sidebar nested active">
|
|
<li class="sidebar"><a href="/wiki/QScript/Introduction.html">QScript Intro</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Private_Members.html">Private Members</a></li>
|
|
<li class="sidebar"><small class="liicon">-</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">Contributing</span></span>
|
|
<ul class="sidebar nested active">
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Contributing.html">Contributing</a></li>
|
|
<li class="sidebar"><small class="liicon">+</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">API</span></span>
|
|
<ul class="sidebar nested">
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/qscript.html">QScript API</a></li>
|
|
<li class="sidebar"><small class="liicon">+</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">Structs</span></span>
|
|
<ul class="sidebar nested">
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QCFunc.html">QCFunc</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QModuleDefFunc.html">QModuleDefFunc</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QReturn.html">QReturn</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QScriptArgs.html">QScriptArgs</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QScriptCallback.html">QScriptCallback</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QScriptClass.html">QScriptClass</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QScriptClassCreator.html">QScriptClassCreator</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QScriptFunction.html">QScriptFunction</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QScriptObject.html">QScriptObject</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QType.html">QType</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/API/Structs/QValue.html">QValue</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="sidebar"><small class="liicon">+</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">Internals</span></span>
|
|
<ul class="sidebar nested">
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/IBaseScriptingInterface.html">IBaseScriptingInterface</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QArgs.html">QArgs</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QCallback.html">QCallback</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QClass.html">QClass</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QFunction.html">QFunction</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QInstance.html">QInstance</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QInterface.html">QInterface</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QMod.html">QMod</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QModule.html">QModule</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Internals/QObject.html">QObject</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="sidebar"><small class="liicon">-</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">Rundown</span></span>
|
|
<ul class="sidebar nested active">
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Rundown/QScriptRundown1.html">QScript Rundown Page 1</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Rundown/QScriptRundown2.html">QScript Rundown Page 2</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Rundown/QScriptRundown3.html">QScript Rundown Page 3</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Rundown/QScriptRundown4.html">QScript Rundown Page 4</a></li>
|
|
<li class="sidebar"><b>QScript Rundown Page 5</b></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Contributing/Rundown/QScriptRundown6.html">QScript Rundown Page 6</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="sidebar"><small class="liicon">+</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">Lua</span></span>
|
|
<ul class="sidebar nested">
|
|
<li class="sidebar"><a href="/wiki/QScript/Lua/Classes.html">Lua Classes</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Lua/Exports.html">Lua Exports</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Lua/Imports.html">Lua Imports</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Lua/Intro.html">Lua Intro</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Lua/Objects.html">Lua Objects</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="sidebar"><small class="liicon">+</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">Squirrel</span></span>
|
|
<ul class="sidebar nested">
|
|
<li class="sidebar"><a href="/wiki/QScript/Squirrel/Exports_And_Imports.html">Squirrel Exports and Imports</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Squirrel/Intro.html">Squirrel Intro</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="sidebar"><small class="liicon">+</small><span onmousedown="toggleTree(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);"><span onmousedown="Press(this);" onmouseleave="unPress(this);" onmouseup="unPress(this);">Tutorial</span></span>
|
|
<ul class="sidebar nested">
|
|
<li class="sidebar"><a href="/wiki/QScript/Tutorial/Chapter1.html">QScript Tutorial Page 1: Mods</a></li>
|
|
<li class="sidebar"><a href="/wiki/QScript/Tutorial/Chapter2.html">QScript Tutorial Page 2: Getting to work</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
<h1>QScript Rundown Page 5</h1>
|
|
|
|
<p>Scripting language interfaces inherit from <a href="/wiki/QScript/Contributing/Internals/IBaseScriptingInterface.html">IBaseScriptingInterface</a>. While there is not one way of implementing the interface, it is best to learn how each one works. Let's start with Lua.</p>
|
|
|
|
<p>When the game starts up, it will initialize all DLLs. During initialization, it will call the <code>Connect()</code> function which you use to connect to other DLLs. Lua connects to tier1, filesystem, and qscript itself. It also sets the <code>current_interface</code> variable to <code>this</code>.</p>
|
|
|
|
<p><small style="position:relative; top:8px; margin:0px;">luainterface/luainterface.cpp</small></p>
|
|
|
|
<div class="codehilite">
|
|
<pre><span></span><code><span class="kt">bool</span><span class="w"> </span><span class="nf">CLuaInterface::Connect</span><span class="p">(</span><span class="n">CreateInterfaceFn</span><span class="w"> </span><span class="n">factory</span><span class="p">)</span>
|
|
<span class="p">{</span>
|
|
<span class="w"> </span><span class="n">ConnectTier1Libraries</span><span class="p">(</span><span class="o">&</span><span class="n">factory</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span>
|
|
<span class="w"> </span><span class="n">ConVar_Register</span><span class="p">();</span>
|
|
<span class="w"> </span><span class="n">g_pFullFileSystem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">IFileSystem</span><span class="o">*</span><span class="p">)</span><span class="n">factory</span><span class="p">(</span><span class="n">FILESYSTEM_INTERFACE_VERSION</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">);</span>
|
|
<span class="w"> </span><span class="n">g_pQScript</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">IQScript</span><span class="o">*</span><span class="p">)</span><span class="n">factory</span><span class="p">(</span><span class="n">QSCRIPT_INTERFACE_VERSION</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">);</span>
|
|
<span class="w"> </span><span class="n">current_interface</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">this</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">true</span><span class="p">;</span>
|
|
<span class="p">}</span>
|
|
</code></pre>
|
|
</div>
|
|
|
|
<p>You are expected to return <code>true</code> if nothing went wrong during connection.</p>
|
|
|
|
<p>After that, other DLLs will call to QScript add their modules. That happens during the <code>Init()</code> phase.<br />
|
|
After each module is loaded (at <code>PostInit()</code>), QScript will call <code>ImportModules()</code> with the modules <code>CUtlVector<QModule*>*</code> you can safely save it to the interface object if you dont want to do anything during import.</p>
|
|
|
|
<p><small style="position:relative; top:8px; margin:0px;">luainterface/luainterface.cpp</small></p>
|
|
|
|
<div class="codehilite">
|
|
<pre><span></span><code><span class="kt">void</span><span class="w"> </span><span class="nf">CLuaInterface::ImportModules</span><span class="p">(</span><span class="n">CUtlVector</span><span class="o"><</span><span class="n">QModule</span><span class="o">*>*</span><span class="w"> </span><span class="n">modules</span><span class="p">)</span>
|
|
<span class="p">{</span>
|
|
<span class="w"> </span><span class="n">m_modules</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">modules</span><span class="p">;</span>
|
|
<span class="p">}</span>
|
|
</code></pre>
|
|
</div>
|
|
|
|
<p>After that, there come the mods. QScript will just give you the file path of the mod along with the <a href="/wiki/QScript/Contributing/Internals/QMod.html">QMod</a> itself. You must check whether the extension matches your scripting language. If it does not, return 0, but if it does, load the file yourself and return a <a href="/wiki/QScript/Contributing/Internals/QInstance.html">QInstance</a> pointer.</p>
|
|
|
|
<p>This is where things start getting complicated.</p>
|
|
|
|
<hr />
|
|
|
|
<div class="framed"markdown="1"><div class="framedinside"><p><a href="/wiki/QScript/Contributing/Rundown/QScriptRundown4.html"><- Prev</a> | <a href="/wiki/QScript/Contributing/Rundown/QScriptRundown6.html">Next -></a></p></div></div>
|
|
|
|
<div class="framed"markdown="1"><div class="framedinside" markdown="1"><p><a href="/wiki/QScript/Contributing/Rundown/QScriptRundown4.html"><- Prev</a> | <a href="/wiki/QScript/Contributing/Rundown/QScriptRundown6.html">Next -></a></p></div></div>
|
|
|
|
</div> |