This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Problem with require
#1
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:

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
Reply


Messages In This Thread
Problem with require - by DGrandes - 30.12.2020, 08:26
RE: Problem with require - by admin - 30.12.2020, 08:37
RE: Problem with require - by DGrandes - 30.12.2020, 08:44
RE: Problem with require - by admin - 04.01.2021, 08:05

Forum Jump: