Lua in SpringRTS/Spring API

From Wikibooks, open books for an open world
Jump to: navigation, search

Callouts[edit]

Spring resources are the ones that are going to provide communication between your Lua code and the Spring engine.

The engine provides a plethora of built-in functions that you can call. These functions are called callouts.

Callins[edit]

Event handlers are also provided and are called callins. Callins are just functions inside your Lua code that get invoked from the engine when certain events take place. For example if a unit get's created or destroyed.

Variables[edit]

Variables are containers that keep values inside them. As their name suggest, their value is variable. Practically that means that you are freely to change the value of a variable in opposition to constants.

Constants[edit]

Constants are containers as well with only difference that their value NEVER changes. Constants are used for things that never change. Practically a constant will be used to keep the number Pi from math, the name of a player etc.