Left for archival purposes.

User avatar
By cocojackr42
#6839 I've already tried to work with this skript, but it seems the esp isnt capable of this. (restarts after dofile)

I thought this category of this forum is just for this...

**edit

Now I wrote some regex-based "parser" for json-maps,.. That works at least. Maybe someone with a little bit more "lua" skill writes a good one usable by the esp.

Code: Select allfunction fromJson(MSG)
   local hashMap = {}
   for k,v in string.gmatch(MSG,'"(%w+)":"(%w+)",') do
      hashMap[k] = v;
   end
   for k,v in string.gmatch(MSG,'"(%w+)":"(%w+)"}') do
      hashMap[k] = v;
   end
   return hashMap
end


function toJson(MAP)
   local outMsg = "{"
   for k,v in pairs(MAP) do
      outMsg = outMsg..'"'..k..'":"'..v..'",'
   end
   return string.sub(outMsg,0,-2)..'}'
end