Lua in SpringRTS/Widgets
Widgets are script files that are executed by each user individually. That means that not all users are obligated to have the same script file. Widgets are usually found in your LUAUI folder in the installation directory. You can add your own widgets files but you must follow some conventions that widgets must follow.
All widget files have in the beginning of the file the callin GetInfo():
name = "Auto reclaim",
desc = "Sets builders to auto reclaim in BA",
author = "Pithikos",
date = "Jan 1, 1900",
license = "GPL",
layer = 0,
enabled = true
In the field name is the name of the widget. Ingame when you press F11 to see all available widgets, the value in this field is what is going to appear there. In the field desc is a small description of what the widget does. In practice the content of this field appears as a tooltip ingame. In the field author is the name of the creator of the widget. In the field date you can find the date the widget was created. License just gives the kind of license which the widget is under. If you want the widget to be kept opensource the most commonly value is GPL. The field layer tells the engine what kind of script this is. Here is a list of possible values:
Lastly the field enabled determines if the widget is loaded by default. In this example the widget will be loaded by default whenever we start the game.