Hello again gurus! KingN00b in the house!
Im trying to download some images from my server but am having trouble passing some json values into a function. I thought i had a pretty good idea of how to use for loops but i know im goofing up somewhere. This is what i have so far, but when i run this, the simulator just hangs on the activity monitor. the function runs perfectly when i hard code the valuse where v is.
function showImage()
native.setActivityIndicator( false )
testImage = display.newImage(v ,system.DocumentsDirectory,60,100);
end
function loadImage()
-- Create local file for saving data
local path = system.pathForFile(v, system.DocumentsDirectory )
local myFile = io.open( path, "w+b" )
native.setActivityIndicator( true ) -- show busy
-- Request remote file and save data to local file
http.request{
url = "http://thisiskel.com/logos/"..v,
sink = ltn12.sink.file(myFile),
}
timer.performWithDelay( 400, showImage)
end
for k,v in pairs(myLogoArray) do
print(v)
--[[
prints:
zippys.png
hilohatties.png
happyhaleiwa.png
nakamura.png
shirokiya.png
--]]
loadImage(v)
end
Am i handling “v” incorrectly? Do i need to concatenate quotes around v in my loadImage function?
Thank you so much in advance. Im just starting out here and Im having a blast learning lua [import]uid: 88004 topic_id: 27139 reply_id: 327139[/import]