so when i try to do :JSONDecode on a json string (that i am aware is huge), it errors Script timeout: exhausted allowed execution time?
function:
local function requestPixels(parameters: {[string]: any}): pixelsData
local url = BASE_URL
for parameter, v in parameters or {} do
url ..= `?{parameter}={v}`
end
return HttpService:JSONDecode( -- error here
HttpService:GetAsync(url) or '{}' -- not here
)
end
i do use parallel luau in the background (only for rendering and also in the backend), but how do i parallel luau when the error is coming from :JSONDecode? (which is built-in)
What are the params your sending? Are they being unpacked via a table or something into the function? (Edit: Saw your using a table, just tell me what params your using)
It’s still erroring despite not entering the parameters? Print the url out after and before the for loop. Tell me what you get.
local function requestPixels(parameters: {[string]: any}): pixelsData
local url = BASE_URL
print(url, "Before")
for parameter, v in parameters or {} do
url ..= `?{parameter}={v}`
end
print(url, "After")
return HttpService:JSONDecode( -- error here
HttpService:GetAsync(url) or '{}' -- not here
)
end
they print out the same url and i don’t think a loop concenating a string would produce that error
no, it will be only called once
sorry for the late response
(keep in mind the backend server takes quite some time to return a response (its short enough to not produce a timedout) so it would take time for me to test your solutions)