<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - Unable to call script function from code with parameters]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=414</link>
		<description><![CDATA[The most recent posts in Unable to call script function from code with parameters.]]></description>
		<lastBuildDate>Thu, 09 Aug 2012 15:00:36 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Unable to call script function from code with parameters]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2357#p2357</link>
			<description><![CDATA[<p>cool, thanks : )</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Thu, 09 Aug 2012 15:00:36 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2357#p2357</guid>
		</item>
		<item>
			<title><![CDATA[Re: Unable to call script function from code with parameters]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2353#p2353</link>
			<description><![CDATA[<p>Right, I&#039;ve just submitted this. It compiles and <em>should</em> work, but I haven&#039;t had a chance to test it. Basically, I&#039;ve kept callFunction in there, but all it does is:</p><div class="quotebox"><blockquote><p>if(startCallFunction(name))<br />&nbsp; &nbsp; endCallFunction();</p></blockquote></div><p>with startCallFunction and endCallFunction doing the actual work. In theory, this should do it.</p>]]></description>
			<author><![CDATA[dummy@example.com (Nistur)]]></author>
			<pubDate>Thu, 09 Aug 2012 14:30:35 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2353#p2353</guid>
		</item>
		<item>
			<title><![CDATA[Re: Unable to call script function from code with parameters]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2351#p2351</link>
			<description><![CDATA[<p>Hi, ok I understand now, arguments can only be pushed after &#039;lua_getglobal&#039;,<br />the begin/end two steps call makes sense, and callFunction won&#039;t need the numArgs parameter.</p><p>Feel free to commit that directly, thank you : )</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Thu, 09 Aug 2012 12:44:02 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2351#p2351</guid>
		</item>
		<item>
			<title><![CDATA[Unable to call script function from code with parameters]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2342#p2342</link>
			<description><![CDATA[<p>We&#039;ve already discussed this before, but I thought I&#039;d make a separate thread in a more logical place.</p><p>Basically, what&#039;s going on is that in order to give parameters to lua, we need to push values in. This is all fine. We can do this. But then we also need to give a number to lua_pcall to tell it how many arguments(so it knows how many to take off the stack). This is also not too much of a problem.</p><p>The problem is when we need to push the arguments after we give it a function to look up (so we say, &quot;we have this function, here are the arguments, oh, and by the way, can you call it with 4 arguments?&quot;)</p><p>I&#039;ve looked into popping the arguments off the stack, then calling lua_getglobal to find the function, then pushing them back on, but this isn&#039;t really realistic for a couple of reasons, firstly, we need to find some way to store them temporarily, and we also need to be able to store them in a general way (so not, for example, convert them into strings, as we lose context)</p><p>At this stage, I&#039;m open to suggestions as to how I can patch this. The easiest way I can see is splitting the call into 2 functions (beginCallFunction(...) endCallFunction(...)) and then wrapping them in callFunction if there are no arguments. For arguments, they can be done in between begin and end. Alternatively, we could somehow build a stack ourselves, and pass the stack to callFunction. Finally, can continue down the popping/pushing route I started taking, but that looked pretty painful...</p>]]></description>
			<author><![CDATA[dummy@example.com (Nistur)]]></author>
			<pubDate>Wed, 08 Aug 2012 18:19:02 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2342#p2342</guid>
		</item>
	</channel>
</rss>
