<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Suggestion: lua-behaviors]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=900&amp;type=atom"/>
	<updated>2013-12-18T19:22:54Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=900</id>
		<entry>
			<title type="html"><![CDATA[Suggestion: lua-behaviors]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6098#p6098"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Aikon]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2730</uri>
			</author>
			<updated>2013-12-18T19:22:54Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6098#p6098</id>
		</entry>
</feed>
