<?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=Modoptions.lua</id>
	<title>Modoptions.lua - 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=Modoptions.lua"/>
	<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Modoptions.lua&amp;action=history"/>
	<updated>2026-04-21T04:25:23Z</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=Modoptions.lua&amp;diff=2225&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=Modoptions.lua&amp;diff=2225&amp;oldid=prev"/>
		<updated>2026-02-24T06:39:03Z</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 23:39, 23 February 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=Modoptions.lua&amp;diff=2224&amp;oldid=prev</id>
		<title>gamedatainter&gt;Flozi: recat to Gamedata, isn&#039;t in the folder, but neither is ModInfo</title>
		<link rel="alternate" type="text/html" href="https://www.fightorder.net/wiki/index.php?title=Modoptions.lua&amp;diff=2224&amp;oldid=prev"/>
		<updated>2013-10-29T18:07:20Z</updated>

		<summary type="html">&lt;p&gt;recat to Gamedata, isn&amp;#039;t in the folder, but neither is ModInfo&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Note: map options (&amp;lt;code&amp;gt;mapoptions.lua&amp;lt;/code&amp;gt;) and game options (&amp;lt;code&amp;gt;modoptions.lua&amp;lt;/code&amp;gt;) are basically the same, so one page for both.&lt;br /&gt;
&lt;br /&gt;
==Purpose==&lt;br /&gt;
Allow players to set game variables via lobby.&lt;br /&gt;
&lt;br /&gt;
==Reading==&lt;br /&gt;
Use [[Lua_SyncedRead#Mod-.2FMap-Options|these functions.]]&lt;br /&gt;
&lt;br /&gt;
To avoid errors &amp;#039;&amp;#039;&amp;#039;check modoptions for being nil&amp;#039;&amp;#039;&amp;#039;, in case the game was not started by a lobby. &lt;br /&gt;
Otherwise you get &amp;quot;&amp;#039;&amp;#039;attempt to index local &amp;#039;modOptions&amp;#039; (a nil value)&amp;#039;&amp;#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
local lolfactor = 100	--some default value to be used when no modoptions are present&lt;br /&gt;
local modOptions = Spring.GetModOptions()&lt;br /&gt;
if (modOptions) then&lt;br /&gt;
	lolfactor = modOptions.lolfactor&lt;br /&gt;
else&lt;br /&gt;
	Spring.Echo (&amp;quot;no modoptions are set&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
Spring.Echo (&amp;quot;lolfactor = &amp;quot; .. lolfactor)&lt;br /&gt;
--do something with lolfactor--&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
===Some simple example===&lt;br /&gt;
Allow players to set start resources.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;local opts= {&lt;br /&gt;
	{&lt;br /&gt;
	key=&amp;quot;startingmetal&amp;quot;,&lt;br /&gt;
	name=&amp;quot;Start Metal&amp;quot;,&lt;br /&gt;
	desc=&amp;quot;How much metal at start?&amp;quot;,&lt;br /&gt;
	type   = &amp;#039;number&amp;#039;,	&lt;br /&gt;
	def    = 4000,&lt;br /&gt;
	min    = 1,&lt;br /&gt;
	max    = 40000,&lt;br /&gt;
	step   = 1,&lt;br /&gt;
	},&lt;br /&gt;
return opts&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gadget that gives the start resources reads it like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;local startingmetal=4000&lt;br /&gt;
local modOptions = Spring.GetModOptions()&lt;br /&gt;
if (modOptions) then startingmetal = modOptions.startingmetal or 4000 end&lt;br /&gt;
Spring.SetTeamResource(teamID, &amp;quot;m&amp;quot;, startingmetal)&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==links==&lt;br /&gt;
zero-K: http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/ModOptions.lua&lt;br /&gt;
&lt;br /&gt;
[[Category:Gamedata]]&lt;/div&gt;</summary>
		<author><name>gamedatainter&gt;Flozi</name></author>
	</entry>
</feed>