problem with Time object

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
bigpea
Posts: 91
Joined: Thursday 11 August 2016 12:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: IT
Contact:

problem with Time object

Post by bigpea »

Hi all,
I'm trying to create a Time object in order to know the difference between a fixed time and the actual time.
I'm following this guide: https://www.domoticz.com/wiki/DzVents:_ ... ime_object but I have a problem.

My code:

Code: Select all

local Time = require('Time')
local t = Time('2016-12-12 07:35:00')
print('t.minutesAgo(): '..t.minutesAgo()) -- difference from 'now' in minutes
The error in console:

Code: Select all

attempt to call field 'minutesAgo' (a number value)
Could you help me please?

Thanks.
bigpea
Posts: 91
Joined: Thursday 11 August 2016 12:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: IT
Contact:

Re: problem with Time object

Post by bigpea »

Sorry, the problem is in the string "t.minutesAgo()"
We have to use this function without the "()", so "t.minutesAgo"
I will ask to correct the guide. :)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: problem with Time object

Post by dannybloe »

Good catch! I fixed it in the documentation.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest