LUA : An easy way to separate an int64 into two int32 ? - 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: LUA : An easy way to separate an int64 into two int32 ? (/showthread.php?tid=2775) |
LUA : An easy way to separate an int64 into two int32 ? - hfebraud - 05.08.2020 Hi everybody, I'm looking for a solution to separate one data int64 into two data int32, in the aim to send energy from a smartlink (int64) via bacnet (int32). In the device wich receive the two point int32 via Bacnet, i will aggregate this two points to reach the original value. Thanks, Best regards RE: LUA : An easy way to separate an int64 into two int32 ? - admin - 05.08.2020 Which device are you using? Latest LM firmware supports int64 in BACnet. RE: LUA : An easy way to separate an int64 into two int32 ? - hfebraud - 05.08.2020 (05.08.2020, 08:11)admin Wrote: Which device are you using? Latest LM firmware supports int64 in BACnet.It's a Wiser for KNX in 2.4.0 RE: LUA : An easy way to separate an int64 into two int32 ? - Daniel - 05.08.2020 There is a fix for this, you can send the whole int64. https://dl.openrb.com/lmup/2020.07.14-bacnet-64bit.lmup You may need latest fw for wiser 2.5.1 RE: LUA : An easy way to separate an int64 into two int32 ? - hfebraud - 05.08.2020 Thanks everybody, it works fine. Solution : firmware 2.5.1 with patch is OK I hope this can help someone else. BR RE: LUA : An easy way to separate an int64 into two int32 ? - Erwin van der Zwart - 05.08.2020 Hi, And if you ever need to do a split with a 8 byte value into 2x 4 bytes you can do it like this: Code: value = 0xffffffff Erwin RE: LUA : An easy way to separate an int64 into two int32 ? - admin - 05.08.2020 @Erwin, you example splits 32 bits into two 16 bit values. Lua bit operations work only with 32 bit numbers. FFI can be used to convert between different types: Code: function u64_to_u32(value) RE: LUA : An easy way to separate an int64 into two int32 ? - Erwin van der Zwart - 05.08.2020 Aahhh, yep your right 4x8 = still 32 (: Sorry missed that on my free day (: RE: LUA : An easy way to separate an int64 into two int32 ? - Daniel - 05.08.2020 Admin has a free week RE: LUA : An easy way to separate an int64 into two int32 ? - Erwin van der Zwart - 05.08.2020 He deserves it! And he is always sharper then me so that’s not an excuse (: BR, Erwin |