probably the easiest way to fix your problem is to update your function to take both a url and a callback that it can invoke after the request has been successfully completed. something like this:
function postProcess(entry)
-- do something with entry
end
function cl_PPlay.getSoundCloudInfo(rawURL, cb)
local entry
local url = "http://api.soundcloud.com/resolve.json?url="..rawURL.."&client_id=92373aa73cab62ccf53121163bb1246e"
http.Fetch(url,
function(body, len, headers, code)
entry = util.JSONToTable(body)
if !entry.streamable then
cl_PPlay.showNotify( "SoundCloud URL not streamable", "error", 10)
return
end
-- here we know entry is good, so invoke our post process function and
-- give it the data we've fetched
cb(entry);
end,
function( error )
print("ERROR with fetching!")
end
);
end
then, you can do stuff like:
cl_PPlay.getSoundCloudInfo('asdfasdf', postProcess)
or
cl_PPlay.getSoundCloudInfo('asdasdf', function(entry)
-- code to do stuff with entry
end)
this is a pretty common javascript idiom since most of what you do in js is event based, http requests are no different.