From ffd05f0be91c43b47f5b4ca92520f61761955536 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Tue, 24 Mar 2026 17:11:56 -0500 Subject: [PATCH 1/2] DRV-19: Replace math.pow with ^ operator for Lua 5.3+ compatibility math.pow was removed in Lua 5.3. Use the ^ operator instead, which works across all Lua versions (5.1+, LuaJIT). Fixes DRV-19 --- src/bthome/parser.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bthome/parser.lua b/src/bthome/parser.lua index 040b338..3e830c8 100644 --- a/src/bthome/parser.lua +++ b/src/bthome/parser.lua @@ -60,9 +60,9 @@ end --- @return integer value Signed integer value local function read_sint_le(data, offset, length) local value = read_uint_le(data, offset, length) - local max_positive = math.floor(math.pow(2, length * 8 - 1)) + local max_positive = math.floor(2^(length * 8 - 1)) if value >= max_positive then - return math.floor(value - math.pow(2, length * 8)) + return math.floor(value - 2^(length * 8)) end return value end From d37cb8cd63269a7a4ee2ea8122b63c9de8dd9bd2 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Tue, 24 Mar 2026 17:19:32 -0500 Subject: [PATCH 2/2] fix: StyLua formatting for ^ operator --- src/bthome/parser.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bthome/parser.lua b/src/bthome/parser.lua index 3e830c8..983ecab 100644 --- a/src/bthome/parser.lua +++ b/src/bthome/parser.lua @@ -60,9 +60,9 @@ end --- @return integer value Signed integer value local function read_sint_le(data, offset, length) local value = read_uint_le(data, offset, length) - local max_positive = math.floor(2^(length * 8 - 1)) + local max_positive = math.floor(2 ^ (length * 8 - 1)) if value >= max_positive then - return math.floor(value - 2^(length * 8)) + return math.floor(value - 2 ^ (length * 8)) end return value end