30.12.2020, 08:26
Hi,
I have a problem with a library. I don´t know how exactly works require but a function doesn´t work sometimes.
In my library user.Varios I have a function like this:
And from resident script (15seg) I call this function
But sometimes objects doesn´t update and when I save again resident script they update correctly. I don´t change nothing in function only save again.
Why does this happend?
Thanks
I have a problem with a library. I don´t know how exactly works require but a function doesn´t work sometimes.
In my library user.Varios I have a function like this:
Code:
local TemporizadoresActivos = {
{
{Nombre = "ACK_Temp_Extractor_Aseo", Input = "1/1/115", Output = "1/1/15", Tiempo = "0/3/31", DG_Tempo_Activo = "34/6/1", DG_Tempo = "34/6/101", Condicion = '3/4/141', ACKCondicion = '3/4/41', T_Activo = false},
},
{
},
}
function Revisar_Temporizadores ()
now = os.time()
for i = 1,#TemporizadoresActivos, 1 do
local tf = "_on"
if i == 2 then tf = "_off" end
for _, pir in ipairs(TemporizadoresActivos[i]) do
if next(pir) then
--log(pir)
key = 'pir_timer_' .. pir.Input .. tf
delta = now - storage.get(key, 0)
if grp.getvalue(pir.DG_Tempo_Activo) and pir.T_Activo then
grp.checkupdate(pir.DG_Tempo,delta)
end
t = grp.getvalue(pir.Tiempo)*60
if pir.Condicion == nil then
if delta > t then
if pir.Output ~= nil then
grp.checkwrite(pir.Output, 0)
end
grp.checkupdate(pir.DG_Tempo_Activo,false)
end
end
end
end -
end
end
And from resident script (15seg) I call this function
Code:
require('user.Varios')
local Revisar_Temporizadores ()
But sometimes objects doesn´t update and when I save again resident script they update correctly. I don´t change nothing in function only save again.
Why does this happend?
Thanks