Jump to content

Lua in SpringRTS/Lua integration with Spring

From Wikibooks, open books for an open world

The Spring engine provides a rich amount of functions and variables that can be used to develop a mod, a map or a widget. It is possible to make mods and maps by just replacing existing 3d models with your own or just tweaking some parameters in the map/mod files. That is the simpliest way to create a new map or mod but doesn't give much freedom. That's where Lua comes to let the user change things dynamically.
With Lua you can add script files to perform any kind of task. You can have a script to handle better artificial intelligence, a script to handle effects, a script to handle unit animations and more. The only limitations are the ones given from the language itself(Lua). If you are developing a map or a mod the script files are just the so called Gadgets. With Lua you can communicate with the Spring engine. That communication takes place with callins, callouts, global variables and global constants.