
local function split(inputstr, sep)
    if sep == nil then
        sep = "%s"
    end
    local t={} ; local i=1
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        t[i] = str
        i = i + 1
    end
    return t
end


local matchId      = ARGV[1]
local matchDetails = split(ARGV[2],',')
redis.call("HSET","BATTLES:MATCH:{"..matchId.."}","LEVEL",matchDetails[2])
redis.call("HSET","BATTLES:MATCH:{"..matchId.."}","GAME",matchDetails[1])