grp.getvalue() returned value - 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: grp.getvalue() returned value (/showthread.php?tid=3535) |
grp.getvalue() returned value - Kapudan - 31.08.2021 Hi all, here a very simple question. What type of data does grp.getvalue() return? I didn't understand why this code works variable = grp.getvalue('1/1/1') if (variable == true) then... while this not variable = grp.getvalue('1/1/1') if (variable == 1) then ... 1/1/1 is defined on LM as 01.001 Switch RE: grp.getvalue() returned value - admin - 31.08.2021 For 01.X types it returns a Boolean value (true/false). In Lua true does not equal 1. RE: grp.getvalue() returned value - Kapudan - 31.08.2021 Thanks. For the future... where can I find such informations to avoid similar silly questions? :-) That's what the reference manual says: "Returns value for the given alias or nil when object cannot be found." RE: grp.getvalue() returned value - admin - 31.08.2021 This is more of a Lua language thing. As described in the manual: Equality (==) first compares the type of its operands. If the types are different, then the result is false (https://www.lua.org/manual/5.1/manual.html#2.5.2) This is what happens if you try to compare true or false to 1. RE: grp.getvalue() returned value - Kapudan - 31.08.2021 Ok, sorry for my unclear question. What I meant was: where can I find the information that grp.getvalues() method returns a boolean value (true/false) if the reference manual only says "Returns value for the given alias or nil when object cannot be found."? RE: grp.getvalue() returned value - admin - 31.08.2021 The value type depends on the datatype. In most cases it will be a number but can also be a Boolean, string or table. You can use log(value) to see what the function returns. |