User Tools

Site Tools


curves

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
curves [2022/05/23 21:11] – [Get value from the curve via Lua] emozolyakcurves [2022/05/24 08:50] – [Get value from the curve via Lua] emozolyak
Line 129: Line 129:
 <code lua - Getter> <code lua - Getter>
 include "curves.lib" include "curves.lib"
-SAFE_VALUE = 10 
  
 function main (userId) function main (userId)
- +    local SAFE_VALUE = 10  
-    local = os.date("*t", os.time())  +    local current_hour tonumber(os.date("*t", os.time())).hour  
-    current_hour = tonumber(t.hour) +     
-    curve_status, y = getCurveValue( "curve_for_current_hour", current_hour ) +    local y, valueOutOfRange = getCurveValue("curve_for_current_hour", current_hour) 
-    if curve_status then+     
 +    if (not valueOutOfRange) then
         WriteReg("value_for_current_hour", y)         WriteReg("value_for_current_hour", y)
     else     else
         WriteReg("value_for_current_hour", SAFE_VALUE)         WriteReg("value_for_current_hour", SAFE_VALUE)
     end     end
-         
- 
 end end
 </code> </code>
curves.txt · Last modified: 2022/05/24 08:52 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki