1
+ --[[
2
+ LTN API demo
3
+ Copyright (c) 2019 Optera
4
+
5
+ For complete listing of events and properties refer to https://forums.factorio.com/viewtopic.php?f=214&t=51072#p397844
6
+
7
+
8
+ This is free and unencumbered software released into the public domain.
9
+
10
+ Anyone is free to copy, modify, publish, use, compile, sell, or
11
+ distribute this software, either in source code form or as a compiled
12
+ binary, for any purpose, commercial or non-commercial, and by any
13
+ means.
14
+
15
+ In jurisdictions that recognize copyright laws, the author or authors
16
+ of this software dedicate any and all copyright interest in the
17
+ software to the public domain. We make this dedication for the benefit
18
+ of the public at large and to the detriment of our heirs and
19
+ successors. We intend this dedication to be an overt act of
20
+ relinquishment in perpetuity of all present and future rights to this
21
+ software under copyright law.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29
+ OTHER DEALINGS IN THE SOFTWARE.
30
+
31
+ For more information, please refer to <http://unlicense.org/>
32
+ --]]
33
+
1
34
-- LTN interface event functions
2
35
function OnStopsUpdated (event )
3
- if event .data then
4
- log (" Stop Data:" .. serpent .block (event ) )
5
- end
36
+ log (" Stop Data:" .. serpent .block (event ) )
6
37
end
7
38
8
39
function OnDispatcherUpdated (event )
9
- if event .data then
10
- log (" Dispatcher Data:" .. serpent .block (event ) )
11
- end
40
+ log (" Dispatcher Data:" .. serpent .block (event ) )
12
41
end
13
42
14
43
---- Initialisation ----
@@ -25,7 +54,7 @@ script.on_load(function(data)
25
54
if remote .interfaces [" logistic-train-network" ] then
26
55
script .on_event (remote .call (" logistic-train-network" , " on_stops_updated" ), OnStopsUpdated )
27
56
script .on_event (remote .call (" logistic-train-network" , " on_dispatcher_updated" ), OnDispatcherUpdated )
28
- --[[ alternative anonymous function:
57
+ --[[ alternative anonymous function:
29
58
has to be copied between on_init and on_load
30
59
script.on_event(remote.call("logistic-train-network", "on_stops_updated"), function(event)
31
60
do something with event.data
0 commit comments