mqttagent

MQTT Lua Agent
git clone https://git.instinctive.eu/mqttagent.git
Log | Files | Refs | README | LICENSE

commit 6814d1dd59052e2d5809aa605ced29a8451718e8
parent e87bdc3f121ca60d0400b74db0aedf8db20d6cb5
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date:   Sun, 12 Jan 2025 20:14:07 +0000

Time argument of timer callback is corrected
Diffstat:
Mmqttagent.go | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mqttagent.go b/mqttagent.go @@ -471,11 +471,12 @@ func runTimers(L *lua.LState) (bool, time.Time) { k, v := timers.Next(lua.LNil) for k != lua.LNil { tbl := v.(*lua.LTable) - t, ok := toTime(L.RawGetInt(tbl, keyTime), now) + luaT := L.RawGetInt(tbl, keyTime) + t, ok := toTime(luaT, now) if !ok { } else if t.Compare(now) <= 0 { L.RawSetInt(tbl, keyTime, lua.LNil) - err := L.CallByParam(lua.P{Fn: L.RawGetInt(tbl, keyCallback), NRet: 0, Protect: true}, v, k) + err := L.CallByParam(lua.P{Fn: L.RawGetInt(tbl, keyCallback), NRet: 0, Protect: true}, v, luaT) if err != nil { panic(err) }