<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - MScript::getInteger]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=411</link>
		<description><![CDATA[The most recent posts in MScript::getInteger.]]></description>
		<lastBuildDate>Sun, 05 Aug 2012 21:13:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: MScript::getInteger]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2279#p2279</link>
			<description><![CDATA[<p>Normally, the -1 is used to parse arrays and special messages,<br />so it depends what you want to do ?</p><p>Are you making a custom function or something different ?</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Sun, 05 Aug 2012 21:13:04 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2279#p2279</guid>
		</item>
		<item>
			<title><![CDATA[Re: MScript::getInteger]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2278#p2278</link>
			<description><![CDATA[<p>I&#039;ve just done a quick test</p><p>&nbsp; &nbsp; const char* params[10];<br />&nbsp; &nbsp; for(int i = 0; i &lt; 10; ++i)<br />&nbsp; &nbsp; &nbsp; &nbsp; params\[i\] = script-&gt;getString((unsigned int)(i - 5));</p><p>Wow. lua is weird. Both positive and negative work :S Weird. I wonder why all lua docs I&#039;ve read would take negative numbers</p>]]></description>
			<author><![CDATA[dummy@example.com (Nistur)]]></author>
			<pubDate>Sun, 05 Aug 2012 21:12:51 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2278#p2278</guid>
		</item>
		<item>
			<title><![CDATA[Re: MScript::getInteger]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2277#p2277</link>
			<description><![CDATA[<p>Ok then, I have no idea how lua works internally, but I am seeing negative indices in things inside MScript.cpp.</p><p>Doesn&#039;t matter if it doesn&#039;t make the build, I guess, I can always hack it for now <img src="http://forum.maratis3d.com/img/smilies/wink.png" width="15" height="15" alt="wink" /> </p><p>script-&gt;getInteger((unsigned int)-1);</p>]]></description>
			<author><![CDATA[dummy@example.com (Nistur)]]></author>
			<pubDate>Sun, 05 Aug 2012 20:50:54 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2277#p2277</guid>
		</item>
		<item>
			<title><![CDATA[Re: MScript::getInteger]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2276#p2276</link>
			<description><![CDATA[<p>I&#039;ve used that to create custom function from c++, it was a long time ago so it&#039;s not fresh in my mind,<br />but I think it was something like :</p><div class="codebox"><pre><code>int myCustomFunction(void)
{
    if(script-&gt;getArgsNumber() == 2)
    {
        int firstArgument = script-&gt;getInteger(0);
        int secondArgument = script-&gt;getInteger(1);

        // do a simple addition
        script-&gt;pushInteger(firstArgument+secondArgument);
        return 1; 
    }

    return 0;
}

script-&gt;addFunction(&quot;myCustomFunction&quot;, myCustomFunction);</code></pre></div><p>I just finished the builds, so lets wait the first debug pass...</p>]]></description>
			<author><![CDATA[dummy@example.com (anael)]]></author>
			<pubDate>Sun, 05 Aug 2012 20:38:39 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2276#p2276</guid>
		</item>
		<item>
			<title><![CDATA[MScript::getInteger]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=2275#p2275</link>
			<description><![CDATA[<p>I&#039;ve been running through my code, trying to expose some helpful things to lua (like messages in my message system) and I was trying to sort one thing, and something felt a bit wrong, so I checked it up. MScript::getInteger (and other get functions) take unsigned int.</p><p>Checking a previous project, indices are usually negative... I just checked the actual code and you&#039;re doing arg+1, which I assume was meant to be, as a C programmer, people would be used to asking for 0 .. n-1 rather than 1 .. n. I think it&#039;s possible to hack it by casting the sign off... but I think the &quot;nicer&quot; way to do it might be to do something like lua_tointeger(m_state, arg - getArgsNumber());</p><p>Wondering if I am still early enough to submit this &quot;fix&quot; in time for the builds... or if it was done like that for a reason I can&#039;t see?</p>]]></description>
			<author><![CDATA[dummy@example.com (Nistur)]]></author>
			<pubDate>Sun, 05 Aug 2012 20:23:33 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=2275#p2275</guid>
		</item>
	</channel>
</rss>
