Skip to content

Instantly share code, notes, and snippets.

View binary1230's full-sized avatar

Dominic Cerquetti binary1230

View GitHub Profile
@binary1230
binary1230 / ghetto_parse_quasi_json.lua
Created June 1, 2016 01:54
Quick n dirty parse values from Telemachus KSP in lua. Never use for anything important, this is code is horrible and insecure
function ghetto_as_hell_parse_json(json)
processed_data = string.gsub(string.gsub(json, "\"", ""), ":", "=")
-- not even remotely secure, never use for anything important EVAR.
parsed = loadstring("return " .. processed_data)()
return parsed
end
json_data='{"p":07,"a0":4359021.16032269,"a1":0,"a2":83.955622485256754,"a3":174.96542675733608,"a4":179.99999446691439,"a5":300821.94285912672,"a6":0.99479834572486814,"a7":0.097586067257674255,"a8":211.47561250913216,"a9":84.824449329557083,"a10":4358745.3389826063,"a11":11.50312}'
-- n={p=07, a0=4359021.16032269, a1=0, a2=83.955622485256754, a3=174.96542675733608, a4=179.99999446691439, a5=300821.94285912672, a6=0.99479834572486814, a7=0.097586067257674255, a8=211.47561250913216, a9=84.824449329557083,a10=4358745.3389826063,a11=11.50312}