Here's snippet, which splits string of data into multiple messages. Each loop selects new part of string with defined length and sends it until all data has been sent.
Please keep in mind, this option is limited due to duty cycle. You can transmit only given amount of times acording to used spreading factor.
totlen = #buf
-- totlen is total length of data, buf is a buffer in which data are stored
-----------------------------------------------------
-- Code that divide buf to multiple messages
-----------------------------------------------------
actlen = 48 --defining payload length for each message
i = 1
j = 0
thislen = 0
while totlen > 0 do
if totlen > (actlen-1) then
thislen = actlen
data = string.sub(buf, i, i+thislen-1)
i = i + thislen
else
thislen = totlen
data = string.sub(buf, i, i+thislen-1)
totlen = 0
i = i + thislen
end
print("Sending data " .. tostring(i-thislen) .. " to " .. tostring(i-1))
api.dumpArray(data)
api.loraSend(ack, receiveTimeout, data, (port+j))
totlen = totlen - thislen
j=j+1
end