Skip to content

Commit

Permalink
Don't use table.insert
Browse files Browse the repository at this point in the history
  • Loading branch information
PerMalmberg committed Jul 30, 2023
1 parent 28ab4ef commit 0964ee2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ clean: clean_cov clean_report
@rm -rf out

test: clean
@echo Runnings unit tests on du-render
@echo Runnings unit tests on du-stream
@LUA_PATH="$(LUA_PATH)" busted . --exclude-pattern=".*serializer.*"
@luacov
@$(CLEAN_COV)
Expand Down
5 changes: 3 additions & 2 deletions src/Stream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,13 @@ function Stream.New(device, parent, timeout)
while data:len() > blockSize - headerSize do
local part = data:sub(1, blockSize)
data = data:sub(blockSize + 1)
table.insert(output.queue, createBlock(blockCount, output, Command.Data, part))
output.queue[#output.queue + 1] = createBlock(blockCount, output, Command.Data, part)
blockCount = blockCount - 1
end

-- Remaining data
if data:len() > 0 then
table.insert(output.queue, createBlock(blockCount, output, Command.Data, data))
output.queue[#output.queue + 1] = createBlock(blockCount, output, Command.Data, data)
end
end

Expand Down

0 comments on commit 0964ee2

Please sign in to comment.