13.10.2016, 20:06
(This post was last modified: 13.10.2016, 20:06 by Erwin van der Zwart.)
Hi,
It should be something like this inside the SMS handler:
Now i fetch the value from the part of text ''va 550 SMS', now the match function grabs the 550 value out of the string, after that i make it a number instead of a string and you can do whatever you want with it.
BR,
Erwin van der Zwart
It should be something like this inside the SMS handler:
Code:
-- incoming sms handler
handler = function(sms)
alert('incoming sms: [%s] %s', tostring(sms.sender), tostring(sms.data))
--******************************************
-- PUT HERE YOUR MATCH TO GET SMS PREPAID VALUE FROM SMS MESSAGE
local amount = sms.data:match([[va (.-) SMS]])
if amount ~= nil then
amount = tonumber(amount)
-- do something with amount
end
-- END MATCH TO GET SMS PREPAID VALUE FROM SMS MESSAGE
--******************************************
-- sms from known number, call parser
if table.contains(numbers, sms.sender) then
parser(sms.data, sms.sender)
end
end
Now i fetch the value from the part of text ''va 550 SMS', now the match function grabs the 550 value out of the string, after that i make it a number instead of a string and you can do whatever you want with it.
BR,
Erwin van der Zwart