<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - How to bind custom lua functions?]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=771</link>
		<description><![CDATA[The most recent posts in How to bind custom lua functions?.]]></description>
		<lastBuildDate>Wed, 11 Sep 2013 18:43:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: How to bind custom lua functions?]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=4949#p4949</link>
			<description><![CDATA[<p>this works like a charm thanks anael&nbsp; <img src="http://forum.maratis3d.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /> .</p>]]></description>
			<author><![CDATA[dummy@example.com (Crucio777)]]></author>
			<pubDate>Wed, 11 Sep 2013 18:43:12 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=4949#p4949</guid>
		</item>
		<item>
			<title><![CDATA[Re: How to bind custom lua functions?]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=4947#p4947</link>
			<description><![CDATA[<p>the function needs to return an int,<br />0 if the lua function doesn&#039;t return anything,<br />1 if the function returns 1 value, 2 for 2 values etc.</p><p>You can send values to lua using MScriptContext pushInt, pushString...<br />And get arguments from the lua call using getInteger, getString...</p><p>exemple :</p><div class="codebox"><pre><code>#include &lt;MEngine.h&gt;
#include &quot;MyPlugin.h&quot;

int myFunction(void)
{
    MEngine * engine = MEngine::getInstance();
    MScriptContext * script = engine-&gt;getScriptContext();
    script-&gt;pushString(&quot;Hello World !&quot;);
    return 1;
}

void StartPlugin(void)
{
    MEngine * engine = MEngine::getInstance();
    MScriptContext* script = engine-&gt;getScriptContext();

    script-&gt;addFunction(&quot;myFunction&quot;, myFunction);
}</code></pre></div><p>In lua the function will be used like this :</p><div class="codebox"><pre><code>text = myFunction() -- &quot;Hello World !&quot;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Wed, 11 Sep 2013 09:44:38 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=4947#p4947</guid>
		</item>
		<item>
			<title><![CDATA[Re: How to bind custom lua functions?]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=4946#p4946</link>
			<description><![CDATA[<p>hey thanks for that just another small question how should the&nbsp; c++ function for lua script&nbsp; should be?<br />can you give me&nbsp; an small example of the function it will be really helpful. i seem to cannot get it right <br />thank you for help.</p>]]></description>
			<author><![CDATA[dummy@example.com (Crucio777)]]></author>
			<pubDate>Wed, 11 Sep 2013 03:43:35 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=4946#p4946</guid>
		</item>
		<item>
			<title><![CDATA[Re: How to bind custom lua functions?]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=4939#p4939</link>
			<description><![CDATA[<p>Hi,<br />yes you can add custom function using a game plugin with MScriptContext :</p><p>MEngine* engine = MEngine::getInstance();<br />MScriptContext* script = engine-&gt;getScriptContext();<br />if(script)<br />&nbsp; &nbsp; script-&gt;addFunction(&quot;myFunction&quot;, myFunction);</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Tue, 10 Sep 2013 18:27:58 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=4939#p4939</guid>
		</item>
		<item>
			<title><![CDATA[How to bind custom lua functions?]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=4938#p4938</link>
			<description><![CDATA[<p>Hello there ,<br />as the topic subject&nbsp; suggests how would one bind custom/new functions for lua scripting . is it possible through game plugin ?.<br />I hope this is the right section for the topic .</p>]]></description>
			<author><![CDATA[dummy@example.com (Crucio777)]]></author>
			<pubDate>Tue, 10 Sep 2013 16:19:40 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=4938#p4938</guid>
		</item>
	</channel>
</rss>
