Hi so I have a string with chunks of information in it. I’m trying to decode the string and extract the information.
This is how I have been doing it, and I know its not the best way.
Here’s the string before:
[lua]
appWarpClient.sendUpdatePeers(
who…"/"
…“what”…"#"
…player1.y…"+"
…vy…"-"
)[/lua]
Here’s how I’ve been decoding it:
[lua]
function onUpdatePeersReceived(update)
who = string.sub(update, 0, string.find(update, “/”)-1)
what = string.sub(update, string.find(update, “/”)+1, string.find(update, “#”)-1)
where = string.sub(update, string.find(update, “#”)+1, string.find(update, “+”)-1)
where = tonumber(where)
_vy = string.sub(update, string.find(update, “+”)+1, string.find(update, “-”)-1)
_vy = tonumber(_vy)
end[/lua]
Does anyone know a cleaner way of doing this because I am quickly running out of symbols that will work