Lua in SpringRTS/Callins

Callins
Callins are functions defined in your script that Spring calls when a determined event takes place.

You should think of callins as event handlers that are met in some programming languages. In every event inside the engine a call comes to your script and invokes your function.

Here's an example: As you see in the table bellow the Initialize callin is invoked whenever a script is loaded. So in this example once the script is loaded by the engine, everything inside the chunk of our function is executed.

In our example we will get a message "Widget has loaded". As the callin Initialize is only invoked once per game, we get that message only once and that is in the beginning of the game.