<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.fightorder.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Animation-CobLuaDifferences</id>
	<title>Animation-CobLuaDifferences - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.fightorder.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Animation-CobLuaDifferences"/>
	<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Animation-CobLuaDifferences&amp;action=history"/>
	<updated>2026-04-21T02:04:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=Animation-CobLuaDifferences&amp;diff=2413&amp;oldid=prev</id>
		<title>Qrow: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Animation-CobLuaDifferences&amp;diff=2413&amp;oldid=prev"/>
		<updated>2026-03-04T00:08:27Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:08, 3 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Qrow</name></author>
	</entry>
	<entry>
		<id>https://www.fightorder.net/wiki/index.php?title=Animation-CobLuaDifferences&amp;diff=2412&amp;oldid=prev</id>
		<title>interanimation&gt;Flozi: 1cat</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Animation-CobLuaDifferences&amp;diff=2412&amp;oldid=prev"/>
		<updated>2013-03-21T10:55:19Z</updated>

		<summary type="html">&lt;p&gt;1cat&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Overview of differences between COB unit scripts and Lua unit scripts ==&lt;br /&gt;
This is only of interest if you plan to port your COB scripts to Lua:&lt;br /&gt;
* Units of measurement: Lua uses elmos and radians consistently.&lt;br /&gt;
* Coordinate system: In Lua, coordinate system is same as world coordinate system, with all rotations right-handed. In COB, the moves along the x-axis and rotations around the z-axis have a different sign.&lt;br /&gt;
* In Lua, &amp;#039;&amp;#039;Killed&amp;#039;&amp;#039; gets recentDamage and maxHealth as separate arguments. In COB, you get only the ratio recentDamage/maxHealth*100.&lt;br /&gt;
* Where COB uses &amp;#039;&amp;#039;SetMaxReloadTime&amp;#039;&amp;#039;, Lua uses &amp;#039;&amp;#039;GetMaxReloadTime&amp;#039;&amp;#039;.&lt;br /&gt;
* Where COB uses &amp;#039;&amp;#039;QueryLandingPadCount&amp;#039;&amp;#039; and &amp;#039;&amp;#039;QueryLandingPad&amp;#039;&amp;#039;, Lua uses &amp;#039;&amp;#039;QueryLandingPad&amp;#039;&amp;#039;&amp;#039;s&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* The x and z arguments to &amp;#039;&amp;#039;HitByWeapon&amp;#039;&amp;#039;, &amp;#039;&amp;#039;HitByWeaponId&amp;#039;&amp;#039; and &amp;#039;&amp;#039;RockUnit&amp;#039;&amp;#039; are given in (x, z) order in Lua, and the opposite order in COB.&lt;br /&gt;
* &amp;#039;&amp;#039;BeginTransport&amp;#039;&amp;#039; and &amp;#039;&amp;#039;EndTransport&amp;#039;&amp;#039; take the height of the unit in COB and the unitID in Lua. (Use &amp;#039;local height = Spring.GetUnitHeight(unitID)&amp;#039; to get the height.)&lt;br /&gt;
* &amp;#039;&amp;#039;TransportDrop&amp;#039;&amp;#039; gets PACKXZ(x,z) in COB; in Lua, it gets the entire vector (x, y, z) as three arguments.&lt;br /&gt;
* Where COB uses &amp;#039;&amp;#039;SetSpeed&amp;#039;&amp;#039; and &amp;#039;&amp;#039;SetDirection&amp;#039;&amp;#039;, Lua uses &amp;#039;&amp;#039;WindChanged&amp;#039;&amp;#039; and &amp;#039;&amp;#039;ExtractionRateChanged&amp;#039;&amp;#039;.&lt;br /&gt;
* Lua does not have &amp;#039;&amp;#039;Go&amp;#039;&amp;#039; (this is called for activated extractors immediately after each &amp;#039;&amp;#039;SetSpeed&amp;#039;&amp;#039; call.)&lt;br /&gt;
&lt;br /&gt;
==Which one is better? Lua or COB unitscripts?==&lt;br /&gt;
If you are starting a new project and wonder what script language to use, look at this list:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;data types:&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - only basic variables.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + arrays, strings and tables.&amp;lt;br&amp;gt;&lt;br /&gt;
This is quite important as it allows for easier creation of advanced scripts.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;availability of examples, documentation&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
COB: + is/was used in Total Annihilation. Lots of third party units were made for that game and maybe you can reuse some scripts.&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - unclear legal status of these scripts&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - Outside of the TA community, there are no tutorials and it is unknown.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + is also used in projects outside Spring, so it has more tutorials. &amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + The documentation on Spring specific Lua will probably get better, COB not.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Interaction with the rest of Spring&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - Typically only basic stuff, but there is a messy way of interacting with gadgets which must be written in a way to support COB interaction.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + can use all the other Lua functions Spring has to offer.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + game logic (gadgets) is written in Lua, too. So you need to know Lua anyway.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Ease of use&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - Requires recompiling the script with a compiler after each change.&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - This compiler appears to be pretty buggy.&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - Compiled scripts are not readable for human eyes, but can be decompiled.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + A text editor is all you need. Many editors support Lua syntax highlighting.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + Scripts are not compiled so it is easy to look at the scripts of other games for examples.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Script performance&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
COB: + Faster for simple scripts that have no interaction with gadgets.&amp;lt;br&amp;gt;&lt;br /&gt;
COB: - Slower when interacting with gadgets, trickier to code such interaction.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: - Slower threading engine.&amp;lt;br&amp;gt;&lt;br /&gt;
Lua: + Faster when interacting with gadgets.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
Unless you already have lots of complex unit scripts by porting TA content, Lua is always better.&amp;lt;br&amp;gt;&lt;br /&gt;
Contra to popular belief, COB is actually not easier to learn.&lt;br /&gt;
&lt;br /&gt;
==Hints==&lt;br /&gt;
* COB &amp;amp; LUS (LuaUnitScripts) can be reloaded ingame via &amp;lt;code&amp;gt;/reloadcob %unitdefname&amp;lt;/code&amp;gt;, also LUS get reloaded with &amp;lt;code&amp;gt;/luarules reload&amp;lt;/code&amp;gt;, too.&lt;br /&gt;
&lt;br /&gt;
==Avoid writting &amp;quot;COB-style&amp;quot; Lua scripts==&lt;br /&gt;
See [http://springrts.com/phpbb/viewtopic.php?f=23&amp;amp;t=25960 this thread] for an example on how you can improve your copy&amp;amp;paste hackjob script.&lt;br /&gt;
&lt;br /&gt;
[[Category:Animation]]&lt;/div&gt;</summary>
		<author><name>interanimation&gt;Flozi</name></author>
	</entry>
</feed>