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
#3
Sorry... I change some parts to reduce the code and I put wrong...
No mistakes in syntax and no mistakes in error log

This is the original code in user.varios
Code:
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)
          CrearDG ("ACK_Temp_"..pir.Nombre, pir.DG_Tempo_Activo, dt.bool,"ACK_Tiempo_Activo")
          CrearDG ("Delta_"..pir.Nombre, pir.DG_Tempo, dt.uint32)
          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
          else
            local cumple = (grp.getvalue(pir.Condicion) - 200) > grp.getvalue(pir.ACKCondicion)
            if (delta > t) and (cumple) then
              grp.checkwrite(pir.Output, 0)
              grp.checkupdate(pir.DG_Tempo_Activo,false)
            elseif (delta > t) and (not cumple) and ((grp.getvalue(pir.DG_Tempo_Activo))) then
              storage.set(key, now)
            end     
                end
            end
    end    --End for temporizadores on off
  end --End for temporizadores
  return ("Temporizadores Revisados")
end --End funcion


And this in resident

Code:
require('user.Varios')
local Revisados = Revisar_Temporizadores ()
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: