Simutrans-Squirrel-API
Variables
api_skeleton.h File Reference

Go to the source code of this file.

Variables

struct {
   string   file
 
map
 
table persistent
 Persistent data should go into this table. More...
 
struct {
   string   api
 Required version of api. More...
 
   string   author
 Author(s) of the scenario and/or scripts.
 
   string   short_description
 Short description of scenario, is shown for example in finance window.
 
   string   version
 Version of script.
 
scenario
 

Detailed Description

Documents the global variables in a scenario script

Definition in file api_skeleton.h.

Variable Documentation

◆ api

string api

Required version of api.

Script requires this version of api. Corresponds to release numbers (e.g. 112.3). Set it to "*" to support nightly versions. If this string is not set, the default "112.3" will be used.

See also
get_api_version

Definition at line 19 of file api_skeleton.h.

◆ file

string file

Name of savegame. The scenario starts with the world saved there. If file == "<attach>" then do not load a saved, attach the scenario to the running world instead.

See also
get_map_file

Definition at line 34 of file api_skeleton.h.

◆ map

struct { ... } map

Information about game map/world.

◆ persistent

table persistent

Persistent data should go into this table.

Only this table is saved and reloaded with an savegame. Only plain data is saved: no classes / functions, no cyclic references.

Instances of classes can be saved if (1) the class implements the function _save that (2) returns something which can reconstruct the instance, i.e. an constructor call, embedded in a string.

class my_class_with_save {
foo = 0
constructor(f)
{
foo = f;
}
function _save()
{
return "my_class_with_save("+ foo + ")"
}
}

Definition at line 67 of file api_skeleton.h.

◆ scenario

struct { ... } scenario

Meta information about the scenario.