arithmetic on local - error - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: arithmetic on local - error (/showthread.php?tid=4387) |
arithmetic on local - error - sx3 - 16.11.2022 I'm trying to subtract numbers from a 4 Byte Signed Int but keep getting this error. Can't figure out how to do the calculation without getting errors. I have 2 meters in series, so I want to down count Wh that have been measured twice. Quote:Energimätare Timme 16.11.2022 20:09:30 Code: -- Begär avläsning från statistikmätaren för Bergvärmen RE: arithmetic on local - error - admin - 17.11.2022 Use this: Code: -- Läs in värdet från Husförbrukningen i Wh Lua multiple assignment works this way: Code: local a, b, c = 1, 2, 3 RE: arithmetic on local - error - sx3 - 17.11.2022 Ahh alright, so my mistake is that I had the res for logging before the variable? So in theory, I wouldn't need the "res" if I want to log a value? Would be enough to just "log(strHuset)" if I want to monitor the value? Cool, learned something new once again. Thank you! RE: arithmetic on local - error - admin - 17.11.2022 res is not needed, the first value in the assignment will have the object value. Code: local strHuset1 = grp.getvalue('7/0/22') Some functions may return multiple values. Many of them use "res, err" form where res is the resulting value and err is the error text (only in case of an error, res is usually nil then). |