mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-27 16:57:21 +00:00
New feature: Lua hooks
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
local file
|
||||
|
||||
function otr_init()
|
||||
otr.log("example.lua starting; writing to /tmp/lua.out")
|
||||
file = io.open("/tmp/lua.out", "a")
|
||||
file:write("written by OwnTracks Recorder version " .. otr.version .. "\n")
|
||||
end
|
||||
|
||||
function otr_hook(topic, _type, data)
|
||||
local timestr = otr.strftime("It is %T in the year %Y", 0)
|
||||
print("L: " .. topic .. " -> " .. _type)
|
||||
file:write(timestr .. " " .. topic .. " lat=" .. data['lat'] .. data['addr'] .. "\n")
|
||||
end
|
||||
Reference in New Issue
Block a user