New feature: Lua hooks

This commit is contained in:
Jan-Piet Mens
2015-09-19 16:11:53 +02:00
parent 5e1fd52f92
commit 6dd03bb0e6
10 changed files with 401 additions and 39 deletions
+13
View File
@@ -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