<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - Suggestion: lua-behaviors]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=900</link>
		<description><![CDATA[The most recent posts in Suggestion: lua-behaviors.]]></description>
		<lastBuildDate>Wed, 18 Dec 2013 19:22:54 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Suggestion: lua-behaviors]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=6098#p6098</link>
			<description><![CDATA[<p>I suggest a new type of behavior.</p><p>In common, behavior is <br /></p><ol class="decimal"><li><p>variables + type</p></li><li><p>update procedure</p></li></ol><p>It can be realized in lua<br /></p><div class="codebox"><pre><code>// behavior_lookat.lua
// pseudo-code
behavior_lookat.vars = {var =&gt; type}
behavior_lookat.object_depended_vars = {}
behavior_lookat.update = &lt;function code here&gt;</code></pre></div><p>In editor add lua-behavior by filename. <br />Editor parse vars-table and show var-list.<br />Editor values stored in object_depended_vars-table with object-name as table-index. </p><p>In main loop<br /></p><ol class="decimal"><li><p>get next object lua-behavior</p></li><li><p>get object name</p></li><li><p>execute &lt;behavior_name&gt;.update with vars from object_depended_vars.objectName-table</p></li></ol><p>The lua function list is short, so lua-beheviors will be scant. But it&#039;s simple way to extend engine <img src="http://forum.maratis3d.com/img/smilies/wink.png" width="15" height="15" alt="wink" /><br />What do you think about this?</p><p>Example: if we want to create FPS then add player, head and camera on scene, add behavior_controllerFPS.lua to player-object, define vars &quot;head&quot; and &quot;camera&quot;.&nbsp; This is all you need to do.</p>]]></description>
			<author><![CDATA[dummy@example.com (Aikon)]]></author>
			<pubDate>Wed, 18 Dec 2013 19:22:54 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=6098#p6098</guid>
		</item>
	</channel>
</rss>
