Simutrans-Squirrel-API
Common pitfalls
local a = {}
// create an empty table
local b = a
// b refers to the same table as a
a.x <- 1
// b.x is now also 1
b.x <- 2
// a.x is changed to 2
local start_time =
settings
.
get_start_time
()
// this call is executed BEFORE the savegame is loaded -> undefined
local factory_coalmine = null
// we can create the variable ...
function
start
()
{
factory_coalmine =
factory_x
(40, 78)
// ... but we can initialize it safely only in a function
}
Generated by
1.8.14