Lua in SpringRTS/Spring API

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

Callouts[edit | edit source]

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 | edit source]

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 gets created or destroyed.

Variables[edit | edit source]

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 | edit source]

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.