HELP, When making a FiveM script I got a little stuck.
i needed to turn this
{“heading”:349.7,“z”:100.0,“y”:8.0,“x”:6.0}
into this
6.0, 8.0, 100, 349.7
and got this far
heading = 349.7, z = 100.0, y = 0.0, x = 0.0
the only problem is… that all of that infomation is stuck inside a variable i need to get it into text form or a table so i can just do
print(z)
Does that make sense? Thanks for help anyway
I fixed my problem Thanks for checking in anyway
heres how (Messy coding)
function GetPosColon(isnew)
return string.gsub(isnew, ":", "")
end
function GetPosopenBracket(isnew)
return string.gsub(isnew, "{", "")
end
function GetPosCloseBracket(isnew)
return string.gsub(isnew, "}", "")
end
function GetPosComVBah(isnew)
return string.gsub(isnew, ",", ", ")
end
function GetPosQuotes(isnew)
return string.gsub(isnew, '"', '')
end
function GetPosHeading(isnew)
return string.gsub(isnew, 'heading', '')
end
function GetPosZED(isnew)
return string.gsub(isnew, 'z', '')
end
function GetPosWHY(isnew)
return string.gsub(isnew, 'y', '')
end
function GetPosEX(isnew)
return string.gsub(isnew, 'x', '')
end
isnew = GetPosColon(isnew)
isnew = GetPosopenBracket(isnew)
isnew = GetPosCloseBracket(isnew)
isnew = GetPosComVBah(isnew)
isnew = GetPosQuotes(isnew)
isnew = GetPosHeading(isnew)
isnew = GetPosZED(isnew)
isnew = GetPosWHY(isnew)
isnew = GetPosEX(isnew)
data = {}
data = {
isnew = isnew
}
--print(isnew[1].data)
print(data.isnew)
--print(data[1].isnew)
print(data)