Skip to content

Commit 13630c6

Browse files
svc-finitelabs[bot]OpenClaw
andauthored
DRV-19: Fix math.pow Lua 5.3+ compatibility (#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 * fix: StyLua formatting for ^ operator --------- Co-authored-by: OpenClaw <openclaw@dmiller.me>
1 parent bd635ba commit 13630c6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/bthome/parser.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ end
6060
--- @return integer value Signed integer value
6161
local function read_sint_le(data, offset, length)
6262
local value = read_uint_le(data, offset, length)
63-
local max_positive = math.floor(math.pow(2, length * 8 - 1))
63+
local max_positive = math.floor(2 ^ (length * 8 - 1))
6464
if value >= max_positive then
65-
return math.floor(value - math.pow(2, length * 8))
65+
return math.floor(value - 2 ^ (length * 8))
6666
end
6767
return value
6868
end

0 commit comments

Comments
 (0)