aboutsummaryrefslogtreecommitdiff
path: root/advtrains/log.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/log.lua')
-rw-r--r--advtrains/log.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/advtrains/log.lua b/advtrains/log.lua
new file mode 100644
index 0000000..827948f
--- /dev/null
+++ b/advtrains/log.lua
@@ -0,0 +1,9 @@
+-- Log accesses to driver stands and changes to switches
+
+advtrains.logfile = advtrains.fpath .. "_log"
+
+function advtrains.log (event, player, pos, data)
+ local log = io.open(advtrains.logfile, "a+")
+ log:write(os.date()..": "..event.." by "..player.." at "..minetest.pos_to_string(pos).." -- "..(data or "").."\n")
+ log:close()
+end